Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cant rename/delete file

Status
Not open for further replies.

hcclnoodles

IS-IT--Management
Jun 3, 2004
123
GB
Hi there, ive made a bit of a boo boo and written a script that out puts a file called "-result" now I cant read it, obviously if I run vi or more , it thinks it is a switch rather than an input file

I tried running ls -l to get the inode number but i searched the man page for "mv" and theres no mention of being able to mv a file by its inode

how do i get to read this file (ps I have no gui)

cheers
 
You mau try something like that

find . -inum XXXX -print

replace XXXX with your file inum number

and then add the rm command next to find
 
Try using a absolute path to it or if you cd to the directory it is in, then use ./-result as in:
mv ./-result result

I hope that helps.

Mike
 
figured it out,

i just need to refer to the file as ./ rather than just the file name



eg

mv ./-file file

rather than

mv -file file (which doesnt work)


cheers
 
This is a 20 year old Unix FAQ. Most unix commands take the argument "--" as a flag to stop reading options.

"rm -- -strange" would remove the file.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top