Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'deleting a file starting with a hyphen' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
deleting a file starting with a hyphen
Authored by: hayne on Oct 15, '02 10:01:55AM

An easier way (also useful for deleting files with spaces in their names, etc.) is to put the filename in double-quotes. For example:
rm "-i"
would remove the file which is the subject of this hint.



[ Reply to This | # ]
deleting a file starting with a hyphen
Authored by: SeanAhern on Oct 15, '02 03:33:05PM

Nope, that wouldn't work. All the quotes would do is tell the shell that -i is one word. To the rm binary, "-i" and -i look the same.

Believe me, I've tried stuff like this before.

Other ways to do it, though:

rm ./-i
rm -- -i



[ Reply to This | # ]