From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14776 invoked from network); 29 Nov 1997 14:53:32 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 29 Nov 1997 14:53:32 -0000 Received: (from list@localhost) by math.gatech.edu (8.8.5/8.8.5) id JAA25043; Sat, 29 Nov 1997 09:44:31 -0500 (EST) Resent-Date: Sat, 29 Nov 1997 09:43:45 -0500 (EST) Message-ID: <19971129094041.42002@retriever> Date: Sat, 29 Nov 1997 09:40:41 -0500 From: Louis-David Mitterrand To: zsh-users@math.gatech.edu Subject: Re: strange arithmetic Reply-To: mito@aparima.com References: <19971128140924.07137@retriever> <347F26A5.BBB84546@sangacorp.com> <19971128153022.58317@retriever> <19971128200444.42485@emsphone.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.88 In-Reply-To: <19971128200444.42485@emsphone.com>; from Dan Nelson on Fri, Nov 28, 1997 at 08:04:44PM -0600 Resent-Message-ID: <"gG5H81.0.g66.Xe2Wq"@math> Resent-From: zsh-users@math.gatech.edu X-Mailing-List: archive/latest/1166 X-Loop: zsh-users@math.gatech.edu X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu On Fri, Nov 28, 1997 at 08:04:44PM -0600, Dan Nelson wrote: > In the last episode (Nov 28), Louis-David Mitterrand said: > > > > % i=0;while ! [[ $[++i] < 900 ]];do;echo $i;done > > > > % 1 > > > > % 2 > > > > [...] > > > > % 90 > > > > > > > > Is this normal? > > > > Thanks to you and zefram, I guess I've been exposed to Perl for a little > > too long (the time I could put off learning shell scripting ;-). > > > > And to think I thought I had discovered a bug in mighty zsh .. > > I'm not sure what Perl has to do with your confusion, unless Perl uses > [[ .. ]] to signify arithmetic evaluation? I'd check the Perl man > pages, but as they are split into 35 (!!!!!) sections, I won't. Thank > goodness for "man zshall". > > I think [[ ]] is a builtin version of the test command, with more > testing capabilities. > > You probably wanted to use the (( )) construct in zsh, to do arithmetic > evaluation of your test. Aha! Right. I hadn't ventured deep engough in zsh's man pages. Sorry for taking bandwidth with "should have RTFM'd" questions. Right now I'm trying to understand bitwise manipulations and every day that passes I thanks zsh for being such a wonderful prototyping tool. No need to compile stuff, just type away and here comes the result... The $[2#10010101] stuff comes real handy there to understand binary format. Again, congratulations to zsh's developers. It's an awesome concentrate of intelligence sitting behind that modest '%' prompt. -- Louis-David Mitterrand http://www.aparima.com mito@aparima.com