zsh-workers
 help / color / mirror / code / Atom feed
* rmstar option nit in 2.6-beta11
@ 1995-11-10 23:05 Mark Borges
  1995-11-10 23:45 ` Richard Coleman
  0 siblings, 1 reply; 3+ messages in thread
From: Mark Borges @ 1995-11-10 23:05 UTC (permalink / raw)
  To: ZSH mailing list

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' ;-)

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?

  -mb-


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: rmstar option nit in 2.6-beta11
  1995-11-10 23:05 rmstar option nit in 2.6-beta11 Mark Borges
@ 1995-11-10 23:45 ` Richard Coleman
  1995-11-11  0:12   ` Barton E. Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Coleman @ 1995-11-10 23:45 UTC (permalink / raw)
  To: zsh-workers

> 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




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: rmstar option nit in 2.6-beta11
  1995-11-10 23:45 ` Richard Coleman
@ 1995-11-11  0:12   ` Barton E. Schaefer
  0 siblings, 0 replies; 3+ messages in thread
From: Barton E. Schaefer @ 1995-11-11  0:12 UTC (permalink / raw)
  To: Richard Coleman, zsh-workers

On Nov 10,  6:45pm, Richard Coleman wrote:
} Subject: Re: rmstar option nit in 2.6-beta11
}
} 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.

Look at the case of

    $ rm foo/file1 bar/*

before you pass judgement.

-- 
Bart Schaefer                     Vice President, Technology, Z-Code Software
schaefer@z-code.com                  Division of NCD Software Corporation
http://www.well.com/www/barts


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1995-11-11  0:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1995-11-10 23:05 rmstar option nit in 2.6-beta11 Mark Borges
1995-11-10 23:45 ` Richard Coleman
1995-11-11  0:12   ` Barton E. Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).