Path: utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!uwmcsd1!marque!uunet!portal!atari!achar From: achar@atari.UUCP (Alan Char) Newsgroups: comp.unix.wizards Subject: Re: fixing rm * (was: Worm/Passwords) Message-ID: <1237@atari.UUCP> Date: 17 Nov 88 19:35:02 GMT References: <1232@atari.UUCP> <564@comdesign.CDI.COM> Reply-To: achar@atari.UUCP (Alan Char) Organization: Atari (US) Corporation, Sunnyvale, California Lines: 32 |In article <564@comdesign.CDI.COM> pst@canary.cdi.com (Paul Traina) writes: ||From article <1232@atari.UUCP>, by achar@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 "? This was the original objection in the article by Richard O'Keefe: You can't change just one thing. --Alan