From: Alain Caron <alainc@sangacorp.com>
To: mito@aparima.com
Cc: zsh-users@math.gatech.edu
Subject: Re: strange arithmetic
Date: Fri, 28 Nov 1997 15:16:37 -0500 [thread overview]
Message-ID: <347F26A5.BBB84546@sangacorp.com> (raw)
In-Reply-To: <19971128140924.07137@retriever>
Louis-David Mitterrand wrote:
> (using 3.0.5)
>
> % i=0;while [[ $[++i] < 900 ]];do;echo $i;done
> % 1
> % 2
> [...]
> % 90
>
> 90 ?? I asked for 900 and it stops at 90. On the other hand the
> following:
>
> % i=0;while ! [[ $[++i] = 900 ]];do;echo $i;done
> % 1
> % 2
> [...]
> % 899
>
> Is this normal?
>
> --
>
> Louis-David Mitterrand
> http://www.aparima.com
> mito@aparima.com
This is, I presume, because ">" and "=" are doing a lexicographic
comparison. For a numeric
comparison, use "-gt" and "-eq" operators.
Alain Caron
alainc@sangacorp.com
next prev parent reply other threads:[~1997-11-28 20:23 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 [this message]
1997-11-28 20:30 ` Louis-David Mitterrand
1997-11-29 2:04 ` Dan Nelson
1997-11-29 14:40 ` Louis-David Mitterrand
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=347F26A5.BBB84546@sangacorp.com \
--to=alainc@sangacorp.com \
--cc=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).