Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: rmstar option nit in 2.6-beta11



> I'm one of the fools who aliases rm to 'rm -i' and who has zsh prompt
> on *. (I know the argument that I'll be burned when I do an rm * on
> another system and expect to be protected. But until then I'll just
> attend `rm -i anonymous meetings' ;-)

REAL men alias `rm' to `rm -f'   :-)

> Anyway, should zsh behave this way under these circumstances:
> 
> 	$ rm *
> 	zsh: sure you want to delete all the files in /foo/bar? n
> 	rm: too few arguments
> 	Try `rm --help' for more information.
> 
> (this is gnu rm, obviously)
> 
> I'd thought the command itself would be aborted, but instead it
> appears to just clean out the arg list for the command. Is this the
> intended behaviour?

Interesting.  Looking at the code, I see that if you do

   $ rm *

and then type `n' when it queries you, it will abort the command with
a return value of 1.  If you type

   $ rm file1 *

and then type `n' when it queries you, it will delete `*' from the argument
list and continue.  Therefore file1 gets deleted and it returns with a
return value of 0.

Not very consistent.  I agree that in this case it's probably better to
just abort the command.  I'll need to check this more carefully, but it
appears you can just replace the lines

uremnode(args, node)'

in that particular piece of code (it's hard for me to give you line numbers
since I've made changes to exec.c) with the lines

lastval = 1;
return;

and then remove the lines

if (!nextnode(firstnode(args)))
    errflag = 1;

I'll look at this some more and try to fix it for beta12.

rc





Messages sorted by: Reverse Date, Date, Thread, Author