On 8/10/11 8:44 PM, Linda Walsh wrote:

> --------------------
>     It sounded to me like $(( )) would be translated into "$( (xxxx) )",
> turning off arithmetic expansion.  Did I read that incorrectly?

Yes.  You missed the content of the resolution and changed language
in the standard:

"The syntax of the shell command language has an ambiguity for
expansions beginning with "$((", which can introduce an arithmetic
expansion or a command substitution that starts with a subshell.
Arithmetic expansion has precedence; that is, the shell shall
first determine whether it can parse the expansion as an
arithmetic expansion and shall only parse the expansion as a
command substitution if it determines that it cannot parse the
expansion as an arithmetic expansion. "

and

"Arithmetic expansions have precedence over command substitutions.
That is, if the shell can parse an expansion beginning with "$(("
as an arithmetic expansion then it will do so. It will only
parse the expansion as a command substitution (that starts with
a subshell) if it determines that it cannot parse the expansion
as an arithmetic expansion."

> If not, then wouldn't
> $((( ))) be turned into $( (( )) ), meaning the arith returns a status,
> and not the calculation.  (I've tested this, and this is the case.

This is demonstrably false.

$ cat x5
echo $((( 4+3 )))
$ ../bash-4.0-patched/bash ./x5
7
$ ../bash-4.1-patched/bash ./x5
7
$ ../bash-4.2-patched/bash ./x5
7


-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    c...@case.edu    http://cnswww.cns.cwru.edu/~chet/

Reply via email to