On Tue, Aug 29, 2006 at 01:57:27PM +0100, Julian Gilbey wrote:
> On Tue, Aug 29, 2006 at 01:40:38PM +0200, David Weinehall wrote:
> > Quoting from "Shell & Utilities"/"2.6.4 Arithmetic Expansion" of SuSv3:
> > 
> > "If the shell variable x contains a value that forms a valid integer
> >  constant, then the arithmetic expansions "$((x))" and "$(($x))" shall
> >  return the same value."
> > 
> > I cannot seem to find any reasonable way to parse this other than that
> > $((x+1)) should be treated in the same way that $(($x+1)) would be.
> 
> Maybe, maybe not.  But this is not the behaviour of dash.  Maybe SuSv3
> differs from POSIX in this respect, or maybe this is a bug in dash?

I don't know, but in my experience posh adheres closer to the standards
than dash does, and posh accepts the $((x+1)) notion.

"The core of the Single UNIX Specification, Version 3 is also IEEE Std
 1003.1. The latest 2004 edition incorporates IEEE Std 1003.1-2001 and
 two technical corrigendum. IEEE Std 1003.1-2001 is a major revision and
 incorporates IEEE Std 1003.1-1990 (POSIX.1) and its subsequent
 amendments, and IEEE Std 1003.2-1992 (POSIX.2) and its subsequent
 amendments, combined with the core volumes of the Single UNIX
 Specification, Version 2. It is technically identical to The Open Group,
 Base Specifications, Issue 6; they are one and the same documents, the
 front cover having both designations. The final draft achieved 98%
 approval by the IEEE ballot group and was officially approved by the
 IEEE-SA Standards Board on December 6th 2001."

In other words, SuSv3 is POSIX.1 + POSIX.2 + errata.

> Also, note that "x+1" is not a shell variable, so $((x+1)) may not be
> treated in the same way as the special case $((x)).

Well, while I guess that is a *possible* interpretation, it would be
fairly inconsistent, something that the rest of SuSv3 tries to avoid,
so it seems highly unlikely.

However, dash does not support $((x)) either, so I'd say that dash is
buggy in any case, since it can be argued that SuSv3 is the clarified
version of POSIX.


Regards: David
-- 
 /) David Weinehall <[EMAIL PROTECTED]> /) Rime on my window           (\
//  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   //  Diamond-white roses of fire //
\)  http://www.acc.umu.se/~tao/    (/   Beautiful hoar-frost       (/


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to