 |
 |
removing a garbled file name.
|
 |
|
 |
|
Forum Regular
Join Date: Oct 2003
Status:
Offline
|
|
I was careless in vi resulting in a file named –1. How can I remove it?
|
|
|
| |
|
|
|
 |
|
 |
|
Grizzled Veteran
Join Date: Nov 2001
Location: Oregon
Status:
Offline
|
|
Use the rm command.
You can use tab completion to enter the filename… just type the first character(s) of the filename then hit the tab key. If multiple files match, you will have to enter more characters; a second tab will get you a list of all filenames which match the pattern.
|
|
|
| |
|
|
|
 |
|
 |
|
Forum Regular
Join Date: Oct 2003
Status:
Offline
|
|
Therein lies the problem. I have been trying rm, but it doesn't like the - (minus sign) in front of the 1. I don't remember creating the file but it must have happened while my fat thumb was using vi.
|
|
|
| |
|
|
|
 |
|
 |
|
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status:
Offline
|
|
Put the filename in quotes so rm doesn't think it's a flag.
You could also just use the Finder, I reckon.
|
|
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
|
| |
|
|
|
 |
|
 |
|
Junior Member
Join Date: Nov 2001
Location: Seattle
Status:
Offline
|
|
Add the "--" option before the file; this stops rm from processing dashes as arguments. Thus:
rm -- -1
|
|
|
| |
|
|
|
 |
|
 |
|
Forum Regular
Join Date: Oct 2003
Status:
Offline
|
|
Juggle5,
That did it. Thank you very much.
|
|
|
| |
|
|
|
 |
|
 |
|
Grizzled Veteran
Join Date: Mar 2004
Status:
Offline
|
|
One could also use absolute paths:
rm /full/path/to/the/file/-1
or [probably], any relative path that doesn't start with the '-' :
rm "$PWD/-1"
(to say nothing of renaming the item with Finder  )
|
|
-HI-
|
| |
|
|
|
 |
|
 |
|
Forum Regular
Join Date: Oct 2003
Status:
Offline
|
|
Thanks Hal,
I'll make a note of that.
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |