[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How do you remove files with bad/wierd names



On Wed, Mar 22, 2000 at 10:14:19PM -0500, Marshal Kar-Cheung Wong wrote:
> I was wondering how to remove a file by the name of --help.tgz?
> (Don't ask...Okay if you really must know, I typed in tgz --help and I
> get that file.  There's no man page for tgz, and I think tgz shouldn't
> accept things starting with -- as file names...)  rm always takes it
> as an option, even if quotes, double-quoted, backslashed,
> regular-expressioned.  Any suggestions?
> 

I don't think tgz is generally called directly. You probably want to use
'tar -czf mydir.tgz mydir/'.  Anyway, from the rm manpage:
 
       GNU rm, like every program that uses the  getopt  function
       to  parse  its  arguments,  lets  you use the -- option to
       indicate that all following arguments are non-options.  To
       remove  a  file  called `-f' in the current directory, you
       could type either
              rm -- -f
       or
              rm ./-f
       The Unix rm program's use of a single `-' for this purpose
       predates the development of the getopt standard syntax.

--
+----------------------------------------------------+
| Eric G. Miller                        egm2@jps.net |
| GnuPG public key: http://www.jps.net/egm2/gpg.asc  |
+----------------------------------------------------+


Reply to: