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

signals in loops



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@xxxxxxxxxxxx



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