Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Oct 2006 11:46:21 -0500
From:      Dan Nelson <dnelson@allantgroup.com>
To:        Bill Moran <wmoran@collaborativefusion.com>
Cc:        freeBSD <freebsd-questions@freebsd.org>, Efren Bravo <efrenba@yahoo.es>
Subject:   Re: rm command problem
Message-ID:  <20061020164621.GA2332@dan.emsphone.com>
In-Reply-To: <20061020123038.2dc602f3.wmoran@collaborativefusion.com>
References:  <20061020162119.49001.qmail@web25221.mail.ukl.yahoo.com> <20061020123038.2dc602f3.wmoran@collaborativefusion.com>

next in thread | previous in thread | raw e-mail | index | archive | help
In the last episode (Oct 20), Bill Moran said:
> In response to Efren Bravo <efrenba@yahoo.es>:
> > Accidentally I've created a file called -exclude and now I cann't
> > delete it.
> > 
> > I tried with:
> > 
> > rm -exclude and rm *exclude but it returns this:
> > 
> > rm: illegal option -- -
> > usage: rm [-f | -i] [-dIPRrvW] file ...
> >        unlink file
> > 
> > How can I delete it?
> 
> rm \-exclude or rm '-exclude'

Actually neither of those will work :)  If '-' was a wildcard character
interpreted by the shell it would have, but rm is the problem here, not
the shell.  You need to either tell rm to ignore leading dashes as
options (using the -- option):

rm -- -exclude

, or move the dash away from the beginning of the path:

rm ./-exclude

-- 
	Dan Nelson
	dnelson@allantgroup.com



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