zsh-users
 help / color / mirror / code / Atom feed
* loop exited when error occurs?
@ 2001-09-19  7:58 Michal Vitecek
  2001-09-19  8:59 ` Michal Vitecek
  0 siblings, 1 reply; 2+ messages in thread
From: Michal Vitecek @ 2001-09-19  7:58 UTC (permalink / raw)
  To: zsh-users

 [ i apologize for sending this to zsh-workers first - a copy&paste
 mistake ]

 hello,

 i've come across another strange behaviour of zsh. if an error occurs the
 loop is exited and the code below it is executed (see example program).

 example program (test.sh):
 
 ----begin----
 
#!/bin/zsh

nexistentdirs=(aaa bbb ccc)
while :; do
    files=(${nonexistentdirs}/*)
    echo "in the loop"
done
echo "out of loop"

 ----end----

 $ chmod +x test.sh
 $ ./test.sh
 ./test.sh:5: no matches found: ccc/*
 out of loop
 $

 $ mkdir aaa bbb ccc
 $ touch aaa/fileA bbb/fileB ccc/fileC
 $ ./test.sh
 in the loop
 in the loop
 ...
 [and so on]

 i'd expect zsh to simply continue executing commands after the faulty command
but it exits the loop and continues simply below the loop. perhaps another bug?

    thanks for your help,
-- 
			fuf


------------------------------ na IRC -------------------------------------
 BillGates [bgates@www.microsoft.com] has joined #LINUX
 ...
 mode/#linux [+b BillGates!*@*] by DoDad
 BillGates was kicked off #linux by DoDad (banned: We see enough of Bill
          Gates already.)
 


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

* Re: loop exited when error occurs?
  2001-09-19  7:58 loop exited when error occurs? Michal Vitecek
@ 2001-09-19  8:59 ` Michal Vitecek
  0 siblings, 0 replies; 2+ messages in thread
From: Michal Vitecek @ 2001-09-19  8:59 UTC (permalink / raw)
  To: zsh-users

 correction - there's a typo in the initialization of 'nonexistentdirs'.
 it should read 'nonexistentdirs=(aaa bbb ccc)'. sorry.

Michal Vitecek <M.Vitecek@sh.cvut.cz> wrote:
> [ i apologize for sending this to zsh-workers first - a copy&paste
> mistake ]
>
> hello,
>
> i've come across another strange behaviour of zsh. if an error occurs the
> loop is exited and the code below it is executed (see example program).
>
> example program (test.sh):
> 
> ----begin----
> 
>#!/bin/zsh
>
>nexistentdirs=(aaa bbb ccc)
>while :; do
>    files=(${nonexistentdirs}/*)
>    echo "in the loop"
>done
>echo "out of loop"
>
> ----end----
>
> $ chmod +x test.sh
> $ ./test.sh
> ./test.sh:5: no matches found: ccc/*
> out of loop
> $
>
> $ mkdir aaa bbb ccc
> $ touch aaa/fileA bbb/fileB ccc/fileC
> $ ./test.sh
> in the loop
> in the loop
> ...
> [and so on]
>
> i'd expect zsh to simply continue executing commands after the faulty command
>but it exits the loop and continues simply below the loop. perhaps another bug?
>
>    thanks for your help,
>-- 
>			fuf
>
>
>------------------------------ na IRC -------------------------------------
> BillGates [bgates@www.microsoft.com] has joined #LINUX
> ...
> mode/#linux [+b BillGates!*@*] by DoDad
> BillGates was kicked off #linux by DoDad (banned: We see enough of Bill
>          Gates already.)
> 

-- 
			fuf


------------------------------ na IRC -------------------------------------
 BillGates [bgates@www.microsoft.com] has joined #LINUX
 ...
 mode/#linux [+b BillGates!*@*] by DoDad
 BillGates was kicked off #linux by DoDad (banned: We see enough of Bill
          Gates already.)
 


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

end of thread, other threads:[~2001-09-19  9:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-09-19  7:58 loop exited when error occurs? Michal Vitecek
2001-09-19  8:59 ` Michal Vitecek

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).