Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Aug 1999 09:08:21 +0200
From:      Gunnar Flygt <gunnar@pluto.sr.se>
To:        "Korchagin, Dmitry" <sting@hippo.ru>
Cc:        FreeBSD Questions <freebsd-questions@FreeBSD.org>
Subject:   Re: Deadless file
Message-ID:  <19990820090821.B24329@sr.se>
In-Reply-To: <000f01beeade$f28515c0$0201a8c0@sting.grata.hippo.ru>; from Korchagin, Dmitry on Fri, Aug 20, 1999 at 11:37:37AM %2B0400
References:  <000f01beeade$f28515c0$0201a8c0@sting.grata.hippo.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Aug 20, 1999 at 11:37:37AM +0400, Korchagin, Dmitry wrote:
> Hello & Help!
> 
> I have created file with name "-z" in mistake and can't remove it.
> 
> $ ls
> -z
> $ rm -z
> rm: illegal option -- z
> 
> How can I remove such files?

Start using the man pages! It's a real good source for knowledge! From
the man page for rm:

The rm command uses getopt(3) to parse its arguments, which allows it to
accept the `--' option which will cause it to stop processing flag op-
tions at that point.  This will allow the removal of file names that be-
gin with a dash (`-'). For example:
rm -- -filename
			  
So in your case `rm -- -z` would do the trick

-- 
                           __o
regards, Gunnar       ---_ \<,_
email: flygt@sr.se ---- (_)/ (_)


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990820090821.B24329>