rm and files beginning with a dash

Chuck Simmons <[email protected]> Fri, 23 Apr 2004 12:51:36 -0700
Newsgroups gmane.comp.gnu.fileutils.bugs
Message-ID <[email protected]>
I could not remove a file whose name began with a dash (e.g. 
"-main-file.tmp").  (Hmmm  I suppose I could have tried "rm 
./-main-file.tmp".)  [Actually, I removed the file, but I used a Solaris 
tool to do the job instead of a GNU tool because the Solaris tool seemed 
easier to use.]

Solaris allows "rm - -main-file.tmp".

The Usage information for 'rm' quoted below suggests that "touch blah ; 
rm blah -main-file.tmp" might work (since it suggests that options and 
files can't be interspersed), but, of course, options and filenames can 
be interspersed.

"
ade:[csimmons_main] dlsun620 csimmons 231> rm --help
Usage: rm [OPTION]... FILE...
Remove (unlink) the FILE(s).

  -d, --directory       unlink directory, even if non-empty (super-user 
only)
  -f, --force           ignore nonexistent files, never prompt
  -i, --interactive     prompt before any removal
  -r, -R, --recursive   remove the contents of directories recursively
  -v, --verbose         explain what is being done
      --help            display this help and exit
      --version         output version information and exit

Report bugs to <[email protected]>.
"

Cs