|
|
Easier ways
That's a very convoluted way of doing it.
For the specific case of a leading hyphen, as has been said elsewhere, most Unix commands have a neat way around it: if you give -- as a parameter, then all following parameters are taken as filenames and not as parameters. So rm -- -myfiledoes the trick very easily, as does rm ./-myfileFor other awkward or unprintable characters, it's often easier to identify the file using the filename completion features built into the shell. If your file is called myfile^?, say, and it's the only one beginning with myfile, then rm myfile*could hardly be easier. If the file is harder to separate out, you can use characters after the *, or instead use one or more of the ? wildcard which matches a single character. You can ensure you're only deleting the right file by trying ls (whatever)before doing the rm (whatever)
Easier ways
My favorite way is to use the -i modifier and a name close to the desired one.
Easier ways
-i is useful but needs to be used with gidd's suggestions or you fall into the same trap.
Easier ways
Or ... just drag it to the Trash! (Cmd-Del) How novel! ;)
Easier ways
Thnx Gidds - that is much easier - plus the code above got mucked up on its way to the posting.... |
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.09 seconds |
|