From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6851 invoked from network); 17 May 2005 14:57:28 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 17 May 2005 14:57:28 -0000 Received: (qmail 89717 invoked from network); 17 May 2005 14:57:20 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 17 May 2005 14:57:19 -0000 Received: (qmail 9479 invoked by alias); 17 May 2005 14:57:11 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 8849 Received: (qmail 9463 invoked from network); 17 May 2005 14:57:10 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 17 May 2005 14:57:10 -0000 Received: (qmail 88076 invoked from network); 17 May 2005 14:57:10 -0000 Received: from p54852a2f.dip0.t-ipconnect.de (HELO solfire) (84.133.42.47) by a.mx.sunsite.dk with SMTP; 17 May 2005 14:56:59 -0000 Received: from localhost ([127.0.0.1]) by solfire with esmtp (Exim 4.42) id 1DY3W1-0003Dd-BZ; Tue, 17 May 2005 16:57:51 +0200 Date: Tue, 17 May 2005 16:57:49 +0200 (CEST) Message-Id: <20050517.165749.74751175.Meino.Cramer@gmx.de> To: schaefer@brasslantern.com Cc: zsh-users@sunsite.dk From: Meino Christian Cramer In-Reply-To: <1050517034852.ZM26898@candle.brasslantern.com> References: <3060c239050516135933fd2ff6@mail.gmail.com> <20050517.051316.74748513.Meino.Cramer@gmx.de> <1050517034852.ZM26898@candle.brasslantern.com> X-Mailer: Mew version 4.1 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 X-SA-Exim-Connect-IP: 127.0.0.1 X-SA-Exim-Rcpt-To: schaefer@brasslantern.com, zsh-users@sunsite.dk X-SA-Exim-Mail-From: Meino.Cramer@gmx.de Subject: Re: Airthmetic confusion... Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-SA-Exim-Version: 4.1+cvs (built Sat, 28 Aug 2004 13:10:40 +0200) X-SA-Exim-Scanned: Yes (on solfire) X-Spam-Checker-Version: SpamAssassin 3.0.2 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, score=-0.5 required=6.0 tests=AWL,BAYES_00, RCVD_IN_NJABL_DUL,RCVD_IN_SORBS_DUL,RCVD_IN_SORBS_WEB autolearn=no version=3.0.2 X-Spam-Hits: -0.5 From: Bart Schaefer Subject: Re: Airthmetic confusion... Date: Tue, 17 May 2005 03:48:52 +0000 Thanks a lot for your explicit explanations. Meino > On May 17, 5:13am, Meino Christian Cramer wrote: > } > } I see that "0" is false and !0 is true...but...we > } are doing arithmetic and not logical evaluation. > > No, that's not true. > > First of all, the closest thing to "logical" evaluation that the > shell does is the &&, ||, etc., subexpressions WITHIN arithmetic > expressions. The && and || constructs that test process success > or failure are NOT "logical" operators -- for one thing, they do > not obey the usual Boolean precedence rules. "set -e" is not a > "logical" comparison by any stretch. > > Second, when you write (( expression )) then you are explicitly > instructing the shell to do BOTH arithmetic evaluation AND shell > expression success/failure. That's what the double parens MEAN, > when not preceded by a dollar sign. > > If you want ONLY arithmetic evaluation, use $(( expression )), > and apply the colon command if necessary, e.g. > > : $(( x = a - b )) > > or > > x=$(( a - b )) > > Those are both successful shell expressions that result in zero- > value assignments to x. > > As with any other programming language, you have to write exactly > what you mean, and you have to follow the language's semantic rules, > not the rules as you think they should be. > > } As a sideffect a previously existant variable become inexistant by > } assigning a "0"? > > What makes you believe that's happening? Assignments can only create > variables, they can't unset them. >