fixing rm * (was: Worm/Passwords)

Richard A. O'Keefe ok at quintus.uucp
Wed Nov 16 13:41:29 AEST 1988


In article <1232 at atari.UUCP> achar at atari.UUCP (Alan Char) writes:
>In article <672 at quintus.UUCP> ok at quintus.UUCP (Richard A. O'Keefe) writes:
>|Moral: you can't change _one_ thing.

>Actually, you can change the shell.  (Nowadays, that's more like three to
>five things.)  For example, I would REALLY appreciate in csh a variable
>	set expandcheck=5
>Comments on this idea?  --Alan

Well, there _is_ such a feature already, except that the limit is rather
high, and you can't change it (:-).  BSDish systems impose a limit of
10,240 bytes of argv[]; this seems to include the pointers, so you can't
pass more than about 2000 files to any command (hence xargs(1)).  The
trouble is that I can't think of a reasonable number for the limit:  I
do "egrep foo $dirs/*.c" (rummaging around in dozens of files) often
enough that I'd find it a nuisance to have to clear a small limit.  If
you are doing something non-destructive to the files, you usually don't
want a limit, it's only if you're over-writing or destroying the files
that you have a problem.  And expandcheck _still_ wouldn't stop

	find . ! -user $LOGNAME -exec rm {} \;

{remove all files not owned by me in the current subtree} -- forget the
"!" and you lose big.  The standard trick for csh is
	alias rm "/bin/rm -i"



More information about the Comp.unix.wizards mailing list