A commonly asked question concerning the use of rm is "How do I remove a filename that starts with a dash?" The problem is that rm expects anything that starts with a dash to be an option (ex. -i for interactive, or -f for force).
Here are two solutions. The first (as documented in the man page for rm) is to put a -- in after the options, but before the filename:
The second solution is to include a full or partial pathname to specify the file:
Sometimes files will be generated that have control characters in their names (frequently caused by line noise when you dial in). These control characters will show up as question marks in the filename when listed with "ls". Since all of the shells will interpret a question mark in a command as a substitute for any single character (see File Globbing), this should work fine, and it usually does:
Sometimes this fails to work. The reason is almost certainly the fault of your shell. If your shell is cshe, it will fail to correctly select some control characters - anything with the eighth bit set will have that bit stripped out, so the shell will give the wrong filename to rm.
The simple solution is to temporarily use another shell:
Last Update: 1/12/94 JGW
Original author: TAF