How do you remove a file whose filename begins with a dash (hyphen or minus) -? I'm ssh'd into a remote OSX server and I have this file in my directory:
tohru:~ $ ls -l
total 8
-rw-r--r-- 1 me staff 1352 Aug 18 14:33 --help
...
How in the world can I delete --help from a CLI? This issue is something that I come across in different forms on occasion, these files are easy to create, but hard to get rid of.
I have tried using backslash
rm \-\-help
I have tried quotes
rm "--help"
How do I prevent the minus (dash or hyphen) character to be interpreted as an option?
rm --helpactually explains how to delete filenames beginning with a-. good question nevertheless. – Lesmana Sep 03 '10 at 06:44--helpisn't always helpful. OS X:rm --helpreturnsrm: illegal option -- -andusage: rm [-f | -i] [-dPRrvW] file .... BusyBox returnsUsage: rm [-irf] FILE.... Therm -- $filetrick is mentioned in the man page on OS X, but most embedded systems don't bother installing the man pages. – Robert Calhoun Nov 19 '20 at 22:36