Operating System - HP-UX
1832606 Members
2128 Online
110043 Solutions
New Discussion

Removing a file named "--hi"

 
SOLVED
Go to solution
Manuales
Super Advisor

Removing a file named "--hi"

Hi ..
for error, i created a file named "--hi"
instead of "hi" ..
how can i delete it?

i'm aplying :
rm "--hi"
and appears:
rm: illegal option -- -
rm: illegal option -- h
rm: illegal option -- i

thanks, Manuales
8 REPLIES 8
Pete Randall
Outstanding Contributor
Solution

Re: Removing a file named "--hi"

try this

rm -- --hi


Pete

Pete
Geoff Wild
Honored Contributor

Re: Removing a file named "--hi"

Try

rm \-\-hi

or remove via the inum

See

http://www.helpdesk.umd.edu/topics/troubleshooting/os/unix/1231/


Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
A. Clay Stephenson
Acclaimed Contributor

Re: Removing a file named "--hi"

rm -- --hi

The "--" tells the command that no further options are to be processed so that "-" has no further significance. The is a standard convention for UNIX commands because it is built into the getopts() library function.
If it ain't broke, I can fix that.
Rodney Hills
Honored Contributor

Re: Removing a file named "--hi"

Or try-

rm ./--hi

HTH

-- Rod Hills
There be dragons...
Manuales
Super Advisor

Re: Removing a file named "--hi"

THANKS ALL!!!
IT WORKED !!!!

THANK YOU VERY MUCH !!!
:0)

Manuales.
Prasad Joshi
Regular Advisor

Re: Removing a file named "--hi"

There are many ways to remove this type of file, I am listing some of them

Get the INODE number===> ls -i
# ls -i
3232 -hi

1. for f in `find . -inum 3232`
do
rm -i $f
done

2. rm -i `find . -inum 3232`

3. find . -inum 3232 -ok rm {} \;

4. rm ./-hi

5. rm $PWD/-hi

6. rm -- -hi


Regards.
Prasad
Manuales
Super Advisor

Re: Removing a file named "--hi"

Thanks Prassad for your attention to answer even have been closed this issue ...

really, thank you very much ... i'd like give you points but i can not do it because i do not have the option to do it because it's a closed issue.

THANKS ...
Manuales.
Pete Randall
Outstanding Contributor

Re: Removing a file named "--hi"

Actually, just so you know, Mauales, you can re-open the thread, assign points, then close the thread again!


Pete

Pete