From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12680 invoked from network); 5 Oct 1998 00:13:43 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 5 Oct 1998 00:13:43 -0000 Received: (from list@localhost) by math.gatech.edu (8.9.1/8.9.1) id UAA09688; Sun, 4 Oct 1998 20:06:30 -0400 (EDT) Resent-Date: Sun, 4 Oct 1998 20:06:30 -0400 (EDT) From: Phil Pennock Message-Id: <199810042318.AAA05187@athenaeum.demon.co.uk> Subject: Bug? in 'integer' behaviour To: zsh-workers@math.gatech.edu Date: Mon, 5 Oct 1998 00:18:03 +0100 (BST) X-Disclaimer-1: Any views expressed in this message, where not explicitly X-Disclaimer-2: attributed otherwise, are mine and mine alone. Such views X-Disclaimer-3: do not necessarily coincide with those of any organisation X-Disclaimer-4: or company with which I am or have been affiliated. X-Personality: INTJ X-Mailer: ELM [version 2.4ME+ PL37 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Resent-Message-ID: <"rLezv3.0.JN2.6s06s"@math> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/4405 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu Hi. I'm not subscribed, so please email me if there's anything else you want to know (but I don't think anything is peculiar to my setup in this one). I'm using version 3.1.4 on Linux/x86. In the distribution is Functions/randline which purports to show a random line from a file. The problem seems to be caused by a variable declared integer not stripping off leading whitespace when assigned to. randline: # get a random line from a file integer z=$(wc -l <"$1") sed -n $[RANDOM%z+1]p "$1" This produces a divide by zero error, as 'z' is always zero. Removing the 'integer' keyword solves this, as does wrapping the RHS of the assignment in $[...]. Is this unintuitively correct (features, gotta love 'em) or a bug? Thanks. -- --> Phil Pennock ; GAT d- s+:+ a22 C++(++++) UL++++/I+++/S+++/H+ P++@ L+++ E-@ W(+) N>++ o !K w--- O>+ M V !PS PE Y+ PGP+ t-- 5++ X+ R !tv b++>+++ DI+ D+ G+ e+ h* !r y?