zsh-users
 help / color / mirror / code / Atom feed
From: Louis-David Mitterrand <mito@aparima.com>
To: zsh-users@math.gatech.edu
Subject: Re: strange arithmetic
Date: Sat, 29 Nov 1997 09:40:41 -0500	[thread overview]
Message-ID: <19971129094041.42002@retriever> (raw)
In-Reply-To: <19971128200444.42485@emsphone.com>; from Dan Nelson on Fri, Nov 28, 1997 at 08:04:44PM -0600

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


  reply	other threads:[~1997-11-29 14:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-11-28 19:09 Louis-David Mitterrand
1997-11-28 19:37 ` Andrew Main
1997-11-28 20:16 ` Alain Caron
1997-11-28 20:30   ` Louis-David Mitterrand
1997-11-29  2:04     ` Dan Nelson
1997-11-29 14:40       ` Louis-David Mitterrand [this message]
1997-11-29 11:44 ` Christopher Croughton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=19971129094041.42002@retriever \
    --to=mito@aparima.com \
    --cc=zsh-users@math.gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).