|
|
Oddest thing I've seen!
This has to be the oddest *nix tip I've seen yet. It took me a while, then I read closely to find that the "rm *" is expanded to "rm file1 file2..." so the file named "-i" will act as a command switch when the expanded command is finally executed.
yikes
I once created a directory by accident thaat began with a "-" I could not delete the #%@$ thing!
deleting a file starting with a hyphen
the command to remove a file starting with a hyphen is 'rm -- file' the -- switches off the flags so that the filename you type is treated as a filename rather than a switch.
deleting a file starting with a hyphen
An easier way (also useful for deleting files with spaces in their names, etc.) is to put the filename in double-quotes. For example:
deleting a file starting with a hyphen
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. |
SearchFrom our Sponsor...Latest Mountain Lion HintsWhat's New:HintsNo new hintsComments last 2 daysLinks last 2 weeksNo recent new linksWhat's New in the Forums?
Hints by TopicNews from Macworld
From Our Sponsors |
|
Copyright © 2014 IDG Consumer & SMB (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. |
Visit other IDG sites: |
|
|
|
Created this page in 0.11 seconds |
|