bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Intriguing error with arithmetic evaluation


From: Greg Wooledge
Subject: Re: Intriguing error with arithmetic evaluation
Date: Tue, 23 Aug 2016 12:26:37 -0400
User-agent: Mutt/1.4.2.3i

On Tue, Aug 23, 2016 at 05:15:25PM +0100, Stephane Chazelas wrote:
> POSIX doesn't specify ((...)) (explicitely leaves it
> unspecified), so is out of POSIX scope anyway.
> 
> It was introduced by ksh88.
> 
> There and in ksh93 (but not pdksh nor zsh)
> 
> ksh -c '((0)); echo X'
> 
> outputs X

You forgot the -e.  Here's ksh88:

$ ksh -e -c '((0)); echo X'
$ uname -a
HP-UX imadev B.10.20 A 9000/785 2008897791 two-user license

ksh93 apparently changed its mind:

$ ksh -e -c '((0)); echo X'
X
$ uname -a
Linux wooledg 4.6.0-0.bpo.1-amd64 #1 SMP Debian 4.6.4-1~bpo8+1 (2016-08-11) 
x86_64 GNU/Linux

> In any case, I'd go with Greg's advice to avoid "set -e".



reply via email to

[Prev in Thread] Current Thread [Next in Thread]