How do I remove a file that begins with a hyphen?
Ans: rm will normally complain about an invalid option if you say: rm -filename
Most UNIX commands will behave this way, treating the characters after the hyphen
as an option.
Rm has an option to say 'end of options, the next parameter is a filename'
The option is '--' (double hyphen)
So you can use: rm -- -filename
Most UNIX commands have a -- option like this to signify end of options.
|