## 14.13. Handling a Filename Starting with a Dash (-)

Sometimes you can slip and create a file whose name starts with a dash (-), like -output or -f. That's a perfectly legal filename. The problem is that Unix command options usually start with a dash. If you try to type that filename on a command line, the command might think you're trying to type a command option.

In almost every case, all you need to do is "hide" the dash from the command. Start the filename with `./` (dot slash). This doesn't change anything as far as the command is concerned; `./` just means "look in the current directory" (Section 1.16). So here's how to remove the file -f:

>     % rm ./-f

(Most rm commands have a special option for dealing with filenames that start with a dash, but this trick should work on all Unix commands.)

-- JP

Copyright © 2003 O'Reilly & Associates. All rights reserved.