From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1024 invoked from network); 28 Nov 1997 20:16:46 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 28 Nov 1997 20:16:46 -0000 Received: (from list@localhost) by math.gatech.edu (8.8.5/8.8.5) id OAA17807; Fri, 28 Nov 1997 14:53:52 -0500 (EST) Resent-Date: Fri, 28 Nov 1997 14:53:33 -0500 (EST) From: Andrew Main Message-Id: <199711281937.TAA12593@taos.demon.co.uk> Subject: Re: strange arithmetic To: mito@aparima.com Date: Fri, 28 Nov 1997 19:37:05 +0000 (GMT) Cc: zsh-users@math.gatech.edu In-Reply-To: <19971128140924.07137@retriever> from "Louis-David Mitterrand" at Nov 28, 97 02:09:24 pm X-Loop: zefram@tao.co.uk X-Headers: in preparation X-Mailer: ELM [version 2.4 PL25] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Resent-Message-ID: <"r487B1.0.iL4.z4oVq"@math> Resent-From: zsh-users@math.gatech.edu X-Mailing-List: archive/latest/1160 X-Loop: zsh-users@math.gatech.edu X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu Louis-David Mitterrand wrote: >% i=0;while [[ $[++i] < 900 ]];do;echo $i;done "<" does a string comparison. For a numeric comparison, you want "-lt". >% i=0;while ! [[ $[++i] = 900 ]];do;echo $i;done "=" (or the preferred "==") also does string comparison. You should really use "-eq" here. I've just noticed that this is exactly the opposite convention from Perl. I can even see why the difference was historically inevitable. -zefram