fixing rm * (was: Worm/Passwords)

Alan Char achar at atari.UUCP
Fri Nov 18 05:35:02 AEST 1988


|In article <564 at comdesign.CDI.COM> pst at canary.cdi.com (Paul Traina) writes:
||From article <1232 at atari.UUCP>, by achar at atari.UUCP (Alan Char):
|| I would REALLY appreciate in csh a variable
|| 
|| 	set expandcheck=5
|| 
|| So that if some shell expansion expanded to more than 5 things, it would
|| prompt for confirmation.
|
|My question is,  if we have the shell fix it,  how can we get the shell
|to understand flags passed to the executable?  To give an example, if I
|do 'rm * .o' I probably wouldn't mind seeing the match message come up.
|
|However, 'rm -f * .o' means do it, yes I mean it, don't ask stupid questions.
|I would use it in a shell script no doubt.  Now of course, it's pretty unlikely
|that's what I meant.  Perhaps better consistency checking in rm itself would
|be the answer.

As is the case now, I think the shell should not have to know about
special flags passed to the executable, so your script will still get
caught.  Of course, after you've debugged your script, you can put
"unset expandcheck" at the top.

|For instance,  have rm (if -f is not used) check each path parameter passed to
|it.  If one doesn't match at existing file at all, ask that the command be
|confirmed.  Well, like any solution that's been discussed so far, this has
|problems too.  I guess the best solution would be a modification of the human
|involved so s/he always types what s/he means to type.  hmmm.

Well, it's not always rm that needs to be checked.  How about
"mv * .o <remote dir>"?  This was the original objection in the article
by Richard O'Keefe:  You can't change just one thing.  --Alan



More information about the Comp.unix.wizards mailing list