Subject: Re: Removing a file "-al"
To: Rakhesh Sasidharan <rakhesh@cse.iitd.ernet.in>
From: Kevin P. Neal <kpneal@pobox.com>
List: netbsd-help
Date: 04/22/2001 12:49:28
On Sun, Apr 22, 2001 at 09:57:09PM +0530, Rakhesh Sasidharan wrote:
> 
> OK, so I screwed up big time, and typed the following
> $ mkdir ls -al
> 
> SO now I have two directories "ls" and "-al".  I removed "ls", but don't
> know how to remove "-al".  All commands fail:
> 
> $ rm -f '-al'
> rm: illegal option -- a
> usage: rm [-f | -i] [-dPRrvW] file ...
>        unlink file

Just about all command line Unix programs use getopt() for argument
parsing, so just about all command line Unix program will allow this
trick to work:

rm -f -- -al

Or, if you prefer:

rm -- -al
-- 
Kevin P. Neal                                http://www.pobox.com/~kpn/

"It sounded pretty good, but it's hard to tell how it will work out
in practice." -- Dennis Ritchie, ~1977, "Summary of a DEC 32-bit machine"