MLUG: Re: [MLUG] deleting a file named '-'
Re: [MLUG] deleting a file named '-'
Email address obfuscation in effect -- please click here to turn it off.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
On Thu, 1 Mar 2001, Igor Izyumin Jr. wrote:
> 
> Mike Miller had written:
> 
> > Darn, I was going to ask how to delete a file with that name but I just
> > figured it out:
> >
> > rm ./-
> 
> Actually, if you have a file with two dashes, it won't work.  The most 
> reliable way to do it is:
> rm -- filename
> The -- tells it that there are no more options.


For once the professor is right and the high school kid is wrong!  :-)
rm ./--  does work.  (but I agree that rm -- -- is a better general approach)
See the following from mlug:

mlug:~> echo '' >! --

mlug:~> ls -l -- --
-rw-r--r--    1 mbmiller mbmiller        1 Mar  1 19:33 --

mlug:~> rm ./--

mlug:~> ls -l -- --
ls: --: No such file or directory


So rm ./-- deleted the file just fine.

Regards,

Mike

--
To manage your subscription, go to http://mlug.missouri.edu/members/edit.php

Archives are available at http://mlug.missouri.edu/list-archives/