zsh-users
 help / color / mirror / code / Atom feed
From: bperkins@netspace.org
To: zsh-users@sunsite.dk
Subject: signals in loops
Date: Mon, 21 Oct 2002 22:49:31 -0400	[thread overview]
Message-ID: <200210220249.g9M2nVO29377@throb.netspace.org> (raw)

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


             reply	other threads:[~2002-10-22  2:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-22  2:49 bperkins [this message]
2002-10-22 15:50 ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200210220249.g9M2nVO29377@throb.netspace.org \
    --to=bperkins@netspace.org \
    --cc=zsh-users@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).