Operating System - HP-UX
1848253 Members
8891 Online
104022 Solutions
New Discussion

Re: File name with "-" as 1st character

 
John A. Hegedus_1
Occasional Contributor

File name with "-" as 1st character

How do I remove a file which has a "-" as the first character????? The system thinks the "-" is part of the command
3 REPLIES 3
John Poff
Honored Contributor

Re: File name with "-" as 1st character

Hi,

One way to do it is like this:

rm -- -filename

The -- tells the rm command that no more command line options are coming so that it will know that any other dashes are part of the filenames.

JP
Prashant Zanwar_4
Respected Contributor

Re: File name with "-" as 1st character

rm --

This shall take your worry away

Thanks
prashant
"Intellect distinguishes between the possible and the impossible; reason distinguishes between the sensible and the senseless. Even the possible can be senseless."
Geoff Wild
Honored Contributor

Re: File name with "-" as 1st character

Check out htis page:

http://unix.t-a-y-l-o-r.com/UMstrange.html

Files that begin with a dash can be removed by typing

rm ./-filename


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.