Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Nov 1998 11:12:48 +0300
From:      Anand Buddhdev <arb@anand.org>
To:        "Leonard C." <leonardc9@usa.net>, questions@FreeBSD.ORG
Subject:   Re: How to delete files starting with "-"?
Message-ID:  <19981124111248.B11637@iconnect.co.ke>
In-Reply-To: <v04011709b2801982e8b9@[10.0.0.2]>; from Leonard C. on Tue, Nov 24, 1998 at 12:12:25AM -0800
References:  <v04011709b2801982e8b9@[10.0.0.2]>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Nov 24, 1998 at 12:12:25AM -0800, Leonard C. wrote:

> I accidentally created a file starting with a dash, and can't seem to
> delete it.  mv, cp, and rm all interpret the dash as an argument.
> 
> If "-foo" is the name of the file, I've tried "-foo", '-foo', and \-foo,
> but none of them work since these just affect the shell rather than the
> actual parsing of the command itself.  Any ideas?  This is driving me
> *absolutely* crazy!

rm ./-foo

The dot-slash causes the shell not to treat the hyphen specially. funnily
though,

rm '-foo' should also work, unless the permissions on the file do not allow
you to delete it. If rm ./-foo does not work, then you should look at the
permission on the file. That may be where your problem lies.

--
Anand

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?19981124111248.B11637>