From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10248 invoked from network); 14 Sep 2002 04:58:07 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 14 Sep 2002 04:58:07 -0000 Received: (qmail 17238 invoked by alias); 14 Sep 2002 04:57:59 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 17671 Received: (qmail 17218 invoked from network); 14 Sep 2002 04:57:57 -0000 From: "Bart Schaefer" Message-Id: <1020914045657.ZM12939@candle.brasslantern.com> Date: Sat, 14 Sep 2002 04:56:57 +0000 In-Reply-To: <871y7xs7yd.fsf@ceramic.fifi.org> Comments: In reply to Philippe Troin "Re: For loop bug" (Sep 13, 5:58pm) References: <20020913233156.324A31C0E9@pwstephenson.fsnet.co.uk> <871y7xs7yd.fsf@ceramic.fifi.org> X-Mailer: Z-Mail (5.0.0 30July97) To: Philippe Troin Subject: Re: For loop bug Cc: zsh-workers@sunsite.dk MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Sep 13, 5:58pm, Philippe Troin wrote: } Subject: Re: For loop bug } } Peter Stephenson writes: } } Does it fix this one as well? } } % for i in 1 2 3; do { {echo $i; [[ $i == 2 ]] && exit 1; } || break }; \ } > done && echo X } 1 } X } % That is not a bug. zagzig% [[ x == y ]] && true zagzig% echo $? 1 Hence { [[ $i == 2 ]] && exit 1; } is false, and { false || break } means break. The && expression is only true if -both- branches are true. Further, { } is not a subshell, so { [[ 2 == 2 ]] && exit 1; } would most likely produce something like login: which might surprise you even more. -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net