Email List: Xaustin-group-lX
[All Lists]

Re: shell, arithmetic expansion and integer constants

To: austin-group-l@xxxxxxxxxxxxx
Subject: Re: shell, arithmetic expansion and integer constants
From: Roger Marquis <marquis@xxxxxxxxx>
Date: Tue, 17 Jun 2008 07:49:02 -0700 (PDT)
References: <20080617140716.GN10734@prunille.vinc17.org>
Vincent Lefevre wrote:
$ echo $((x))
sh: 1+: syntax error: operand expected (error token is "+")
That's bash syntax, but the error indicates Bourne sh.  Bourne is a
standard across Unix/Linux OS whereas bash is, well, bash comes several
versions.

Roger Marquis

PS. Where is the online POSIX Bourne shell spec?

PPS. Common syntax must retain backwards compatibility.  It was difficult
 enough having to add LANG=C and _POSIX2_VERSION=199209 to dozens of scripts
 after the syntax for sort was changed (without adequate involvement of the
 sysadmin community IMO) just to be able to sort by syslog datestamps. Date
 sorting is one of the most common sort usages, but was left out of the
 POSIX spec, and dropped wholesale by GNU implementations.

<Prev in Thread] Current Thread [Next in Thread>