[comp.os.minix] Removing "-" prefixed files

kcwellsch@watdragon.UUCP (03/02/87)

>I don't think MINIX is to blame here for rm.  This is because if you say
>something like "rm -foobar" it looks like an option to rm.  I have seen this
>behavior in most UNIX systems.  You can do something like "rm -i *foobar" to
>get rid of files like this.

The best solution I've seen for removing files that begin with "-" is
just:

	% rm  ./-  ./-foobar  ...

By putting a valid directory path in front, "rm" will not see a "-"
prefix. Equally applicable is "../dir/-" and the list goes on...

Classic ways to produce a file starting with "-"? Have you ever tried

	% cc -O -o -c file file.c

where you've accidentally got "-o" and "-c" swapped?

kneller@ucsfcgl.UUCP (03/04/87)

In article <2375@watdragon.UUCP> kcwellsch@watdragon.UUCP (Ken Wellsch) writes:
>>I don't think MINIX is to blame here for rm.  This is because if you say
>>something like "rm -foobar" it looks like an option to rm.  I have seen this
>>behavior in most UNIX systems.  You can do something like "rm -i *foobar" to
>>get rid of files like this.
>
>The best solution I've seen for removing files that begin with "-" is
>just:
>
>	% rm  ./-  ./-foobar  ...
>

4.x bsd rm will take a single '-' to indicate the end of the options,
so "rm - -foobar" will remove "-foobar".  Also "rm foo -foobar" will warn
about not being able to remove "foo", then proceed to remove "-foobar".
-----
	Don Kneller
UUCP:	...ucbvax!ucsfcgl!kneller
ARPA:	kneller@cgl.ucsf.edu
BITNET:	kneller@ucsfcgl.BITNET