zsh-users
 help / color / mirror / code / Atom feed
* signals in loops
@ 2002-10-22  2:49 bperkins
  2002-10-22 15:50 ` Bart Schaefer
  0 siblings, 1 reply; 2+ messages in thread
From: bperkins @ 2002-10-22  2:49 UTC (permalink / raw)
  To: zsh-users

I've been using zsh for a while, and I'd swear you used to be able to
do this:

for foo in 1 2 3 4 5 6 ; do xmessage $foo; done


and you could give control-c to kill the xmessage and the next one
would pop up.  In fact in a bash FAQ I found (which has this same
behavior, BTW), it said that if you wanted this to happen (with control-z
anyway), you have to type:

(for foo in 1 2 3 4 5 6 ; do xmessage $foo; done)

Which make complete sense to me, since the for loop can't receive a
signal unless it's a subshell.

It seems that this essentially does things the old way:

( trap continue INT; for foo in 1 2 3 4 5 ; do xmessage $foo ; done)

Which brings up a mostly acidemic question, what is the default
"trap?"

It seems to be something like:

trap "break -1" INT

Assuming that break -1 breaks from all loops.

--
"I know you believe you understand what you think I said, but I am not
            sure you realise that what you heard is not what I meant."
			    -- Alan Greenspan
Brian Perkins                                bperkins@netspace.org


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

end of thread, other threads:[~2002-10-22 15:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-22  2:49 signals in loops bperkins
2002-10-22 15:50 ` Bart 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).