*BSD News Article 42517


Return to BSD News archive

Newsgroups: comp.unix.bsd
Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!msunews!uwm.edu!news.alpha.net!news.mathworks.com!uhog.mit.edu!europa.eng.gtefsd.com!howland.reston.ans.net!swrinde!pipex!uknet!festival!dcs.ed.ac.uk!jgm
From: jgm@dcs.ed.ac.uk (Jim McDonald)
Subject: Re: HELP!! how do you delete...
Message-ID: <jgm.792890050@dcs.ed.ac.uk>
Sender: cnews@dcs.ed.ac.uk (UseNet News Admin)
Organization: Department of Computer Science, Edinburgh University
References: <rwa.792459321@aupair.cs.athabascau.ca> <1995Feb15.190007.11640@zippy.dct.ac.uk>
Date: Wed, 15 Feb 1995 23:14:10 GMT
Lines: 40

In <1995Feb15.190007.11640@zippy.dct.ac.uk> amm@tremas.dct.ac.uk (Angus Marshall) writes:

>rwa@aupair.cs.athabascau.ca (Ross Alexander) writes:
>> cs230457@vtaix.cc.vt.edu (Scott Gasch) writes:
>> 
>> >Steve Gibson (ares@freeside.fc.net) wrote:
>> >: reading this next question.  How does one delete a file that starts with 
>> >: a "-"? 
>> >Try either:
>> >	rm ./-whatever
>> The canonical correct answer.
>> >	rm ?whatever
>> Won't work.  Think about it.
>> regards,
>> Ross

>rm "-whatever"
>should do it ?

Nope - there double quotes, in this case, make no difference.

What a lot of people seem to be missing in this discussion is that the
wildcard completion doesn't happen in rm itself, but in the shell.
Hence, if you try
		  rm ?whatever
then your shell will pass that to rm as
		  rm -whatever
with the resulting (wrong) behaviour.

Incidentally, if you touch a file called '-i' in your directories,
then a rm * will pick the -i up as the first file (if indeed it is)
and take it as an argument - useful if you have the occasional 'slip'
when removing files :)
(This will only work if -i is the first file in the directory
listing).
-- 
--
         Jim McDonald - jgm@dcs.ed.ac.uk, jgm@tardis.ed.ac.uk
	  Tardis System Administration<sigh>, University of Edinburgh
                WWW - http://www.tardis.ed.ac.uk/~jgm/