From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1013 invoked from network); 19 Sep 2001 09:00:29 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 19 Sep 2001 09:00:29 -0000 Received: (qmail 7899 invoked by alias); 19 Sep 2001 09:00:05 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 4260 Received: (qmail 7869 invoked from network); 19 Sep 2001 09:00:03 -0000 Date: Wed, 19 Sep 2001 10:59:57 +0200 From: Michal Vitecek To: zsh-users@sunsite.dk Subject: Re: loop exited when error occurs? Message-ID: <20010919105957.B2437@fuf.sh.cvut.cz> Mail-Followup-To: Michal Vitecek , zsh-users@sunsite.dk References: <20010919095851.A2220@fuf.sh.cvut.cz> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2i In-Reply-To: <20010919095851.A2220@fuf.sh.cvut.cz>; from M.Vitecek@sh.cvut.cz on Wed, Sep 19, 2001 at 09:58:51AM +0200 correction - there's a typo in the initialization of 'nonexistentdirs'. it should read 'nonexistentdirs=(aaa bbb ccc)'. sorry. Michal Vitecek 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.)