On 7/9/22 5:58 PM, Steffen Nurpmeso wrote:
Hey,

sorry to come back, but when banging against ?: implementation
i saw this bash 5.1.16 bug:

   $ bash -c 'I=3; echo "$((1?(I*=I):(I+=I)))";echo $I'

The parens override precedence.

   $ bash -c 'I=3; echo "$((1?(I*=I):I+=I))";echo $I'
   bash: line 1: 1?(I*=I):I+=I: attempted assignment to non-variable (error token is 
"+=I")

The normal rules of precedence apply, and the conditional expression on the
rhs of the `:' can't contain an assignment, since the assignment operator
has higher precedence.


   $ bash -c 'I=3; echo "$((1?I*=I:(I+=I)))";echo $I'

The parens override precedence.


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

Reply via email to