Deleting a file name beginning with a hyphen
Ken Leyba
kenleyba
Thu Oct 20 10:11:19 PDT 2005
rm ./-C
-or-
rm -- -C
Both of those work, see the man page for rm.
rm \-C
-and-
rm ?C
didn't work on my system.
I created the dummy file by doing this: ls > -C
Then tested removing the file.
Ken
On 10/20/05, Federico Voges <ftc at ftc.com.ar> wrote:
> jamesm at jamesmcdonald.id.au wrote:
>
> >As you can see from the following I have finally deleted this annoying
> >file with the name `-C' I was trying to delete it using \ to escape the -
> >characters. I was just on the verge of emailing Y'ALL when I had a final
> >go and
> >found that you have to specify the full path.... sigh live and learn
> >
> >
> >[root at apf-ma-qad01 root]# ls
> >anaconda-ks.cfg -C evolution install.log.syslog
> >subversion
> >bin desktop28install install.log mbox
> >[root at apf-ma-qad01 root]# rm '-C'
> >rm: invalid option -- C
> >Try `rm --help' for more information.
> >[root at apf-ma-qad01 root]# rm '\-C'
> >rm: cannot lstat `\\-C': No such file or directory
> >[root at apf-ma-qad01 root]# rm "\-C"
> >rm: cannot lstat `\\-C': No such file or directory
> >[root at apf-ma-qad01 root]# rm -C
> >rm: invalid option -- C
> >Try `rm --help' for more information.
> >[root at apf-ma-qad01 root]# rm \\-C
> >rm: cannot lstat `\\-C': No such file or directory
> >[root at apf-ma-qad01 root]# rm /root/-C
> >rm: remove regular file `/root/-C'? y
> >[root at apf-ma-qad01 root]#
> >
> >
> rm \-C
> and
> rm -- -C
> should have worked too :)
>
> In some cases you could have also used:
> rm ?C
>
> Cheers,
> Fed.
> _______________________________________________
> Linux-users mailing list ( Linux-users at linux-sxs.org )
> Unsub/Password/Etc: http://mail.linux-sxs.org/cgi-bin/mailman/listinfo/linux-users
>
> Need to chat further on this subject? Check out #linux-users on irc.linux-sxs.org !
>
--
Computers are useless. They can only give you answers.
-Pablo Picasso
More information about the Linux-users
mailing list