*BSD News Article 42345


Return to BSD News archive

Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!msunews!agate!howland.reston.ans.net!news.sprintlink.net!peernews.demon.co.uk!cuillin.org.uk!cuillin.demon.co.uk!guy
From: guy@cuillin.demon.co.uk (Guy Dawson)
Newsgroups: comp.unix.bsd
Subject: Re: HELP!! how do you delete...
Date: 11 Feb 1995 18:27:29 GMT
Organization: Cuillin
Lines: 27
Distribution: world
Message-ID: <3hivih$r4t@dearg.cuillin.org.uk>
References: <3hfagp$fiv@villa.fc.net> <3hg7m1$lb0@gatekeeper.cognos.com>
NNTP-Posting-Host: dearg.cuillin.org.uk

|> Steve Gibson (ares@freeside.fc.net) wrote:
|> : Help!  I'm a unix novice as will probably become painfully obvious in 
|> : reading this next question.  How does one delete a file that starts with 
|> : a "-"?  The 'rm' command won't accept it since it uses the "-" to denote 
|> : whatever feature you want to turn on...  So, there has to be a way to get 
|> : rid of these files!  Please help!

Try this

	rm -- -file

The -- tells the getopt function used by rm to parse the command line that
its parsed all the command flags and what comes next is arguments. Thus the
'-file' is treated like an argument and the file can be deleted.

If your rm still chucks try the following :

	touch xxx
	rm xxx -file

This time the file xxx (not being a flag) stops all flag processing and
the rest of the command line is treated as arguments.
   
Guy
-- --------------------------------------------------------------------------
   Guy Dawson @ home - guy@cuillin.org.uk // ICBM - 6.15.16W 57.12.23N 986M
   4.4>5.4 4.4>5.4 4.4>5.4 4.4>5.4 4.4>5.4 4.4>5.4 4.4>5.4 4.4>5.4 4.4>5.4