Archive for October, 2005

How to delete a file whose name begins with a “-” character?

Saturday, October 8th, 2005

The easiest way to do the job is something as follows:

rm ./-file_to_delete

Another approach that is useful for commands that use getopt to parse the arguments is shown next:

rm — -file_to_delete

This tells the command rm (or whatever command that uses getopt) that anything after “–” is not an option.