zsh-workers
 help / color / mirror / code / Atom feed
From: "Andrej Borsenkow" <borsenkow.msk@sni.de>
To: "ZSH workers mailing list" <zsh-workers@sunsite.auc.dk>
Subject: pws-22: killing the ZSH loops problem
Date: Tue, 15 Jun 1999 20:45:04 +0400	[thread overview]
Message-ID: <001901beb74e$6b1dcdc0$21c9ca95@mow.siemens.ru> (raw)

I wanted to gzip a bunch of files, so I did

for i in *.txt
do
gzip $i
done

I overlooked that I had (plenty of) already gzipped versions, so after I hitted
a couple of times "n" (as a reply to gzip, if I want to overwrite it) the next
time I just hitted ^C to stop the whole story.  It did not. It just killed the
current gzip and for loop happily ran the next one. The easy way to reproduce it
is

bor@itsrm2:~%> while true
while> do
while> echo $((i++))
while> sh -c "read line"
while> done
0
^C
1
^C
2

Note, that hitting ^C simply kills started command instead of killing the whole
loop. The same happens with pws-19. ^Z does not help either - it stops the
current inner command.

Compare it with shell:

bor@itsrm2:~%> sh
$ i=0
$ while true
> do
> i=`expr "$i + 1"`
> echo $i
> sh -c "read line"
> done
0 + 1

0 + 1 + 1

0 + 1 + 1 + 1
^C
$

(sorry, expr was wrong, but I have not used it for quite a long time). Note,
that in shell it kills the whole loop.

/andrej


             reply	other threads:[~1999-06-16 14:31 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-06-15 16:45 Andrej Borsenkow [this message]
1999-06-16 15:14 ` Peter Stephenson
1999-06-16 17:16   ` Bart Schaefer
1999-06-16  8:43 Andrej Borsenkow
1999-06-16  9:09 Andrej Borsenkow
1999-06-17  9:23 Sven Wischnowsky
1999-06-18  8:55 Sven Wischnowsky
1999-06-18 15:33 ` Andrej Borsenkow
1999-06-18 16:44   ` Bart Schaefer
1999-06-21  7:08     ` Andrej Borsenkow
1999-06-21 15:55       ` Bart Schaefer
1999-06-21 16:14         ` Andrej Borsenkow
1999-06-21 11:29 Sven Wischnowsky

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='001901beb74e$6b1dcdc0$21c9ca95@mow.siemens.ru' \
    --to=borsenkow.msk@sni.de \
    --cc=zsh-workers@sunsite.auc.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).