Fun with *

Obnoxious Math Grad Student weemba at garnet.berkeley.edu
Sun Nov 20 13:21:16 AEST 1988


In article <8445 at alice.UUCP>, ark at alice (Andrew Koenig) writes:
>In article <17247 at agate.BERKELEY.EDU>, weemba at garnet.berkeley.edu (Obnoxious Math Grad Student) writes:
>> And while you're at it, don't forget the problem of the lexicograph-
>> ically first file being named "-f".

>If your rm command uses getopt, you can remove a file named "-f" by saying

>	rm -- -f

I'm not asking about how to remove the file (thanks, anyway, although
I see the how-many-ways-to-do-so discussion is starting up again): I'm
just saying that "while you're at it [ie, `fixing' rm *]", you as might
as well consider the problem of the user who wants to remove some of his
files, and types "rm -i *", expecting to get interactive prompting, and
instead has all his files removed.  If the first file is "-f", you now
have one unhappy user.

"rm -i -- *" will avoid this problem, but I don't expect a lot of people
to get into the habit of typing "--" here and in similar situations.

ucbvax!garnet!weemba	Matthew P Wiener/Brahms Gang/Berkeley CA 94720



More information about the Comp.unix.wizards mailing list