From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15791 invoked from network); 19 Sep 2005 14:42:04 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 19 Sep 2005 14:42:04 -0000 Received: (qmail 69520 invoked from network); 19 Sep 2005 14:41:58 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 19 Sep 2005 14:41:58 -0000 Received: (qmail 28168 invoked by alias); 19 Sep 2005 14:41:55 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 21734 Received: (qmail 28159 invoked from network); 19 Sep 2005 14:41:54 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 19 Sep 2005 14:41:54 -0000 Received: (qmail 69248 invoked from network); 19 Sep 2005 14:41:54 -0000 Received: from mailhost1.csr.com (HELO MAILSWEEPER01.csr.com) (81.105.217.43) by a.mx.sunsite.dk with SMTP; 19 Sep 2005 14:41:54 -0000 Received: from exchange03.csr.com (unverified [10.100.137.60]) by MAILSWEEPER01.csr.com (Content Technologies SMTPRS 4.3.12) with ESMTP id for ; Mon, 19 Sep 2005 15:39:32 +0100 Received: from csr.com ([10.102.144.127]) by exchange03.csr.com with Microsoft SMTPSVC(5.0.2195.6713); Mon, 19 Sep 2005 15:43:24 +0100 To: zsh-workers@sunsite.dk (Zsh hackers list) Subject: Re: Bug or misundertanding from my part? In-reply-to: <20050919143235.GA2831@DervishD> References: <20050919143235.GA2831@DervishD> Date: Mon, 19 Sep 2005 15:41:53 +0100 Message-ID: <14544.1127140913@csr.com> From: Peter Stephenson X-OriginalArrivalTime: 19 Sep 2005 14:43:24.0729 (UTC) FILETIME=[7D3B0A90:01C5BD28] X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.0.4 DervishD wrote: > Hi all :) > > In the ZSH manual for 4.2.5 we can read: > > { TRY-LIST } always { ALWAYS-LIST } > First execute TRY-LIST. Regardless of errors, or break, continue, > or return commands encountered within TRY-LIST, execute > ALWAYS-LIST. Execution then continues from the result of the > execution of TRY-LIST; in other words, any error, or break, > continue, or return command is treated in the normal way, as if > ALWAYS-LIST were not present. The two chunks of code are referred > to as the `try block' and the `always block'. > > So, this code should print "try list" and "always list", but it > doesn't: > > #!/bin/zsh > emulate -L zsh > > { > print "try list" > return 13 > } always { > print "always list" > return 0 > } > > print "What?" > > The code above just prints "try list" and exits with a return > code of "13", but the manual says that the ALWAYS-LIST is executed > "Regardless of [...] return commands encountered [...]". Am I doing > something wrong? I'm a bit puzzled because the above works if I > change 'return 13' for 'false'. You're running this as a script, right? In that case the returns are treated as exits, which have an immediate effect. To treat returns as returns you need a function. pws ********************************************************************** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. **********************************************************************