bug-bash
[Top][All Lists]
Advanced

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

Re: V+=1 doesn't work if V is a reference to an integer array element


From: Chet Ramey
Subject: Re: V+=1 doesn't work if V is a reference to an integer array element
Date: Wed, 13 Jan 2021 15:55:54 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.6.0

On 1/13/21 12:00 PM, Oğuz wrote:
See:

     $ declare -ai a=1
     $ declare -n b=a[0]
     $ b+=1
     bash: a[0]1: syntax error in expression (error token is "1")

Reproducible on 5.1.4 too

Interesting. The root cause of this problem has existed since June, 2012,
when I first added namerefs. When I went looking for the reason it seemed
to work in bash-4.4 but not bash-5.0, I discovered it was masked until
March, 2017, so it `worked' in bash-4.3 and bash-4.4, until that dependency was fixed.

I agree that it should work -- there doesn't seem to be any reason it
shouldn't -- so I will make it work again in the next devel branch push.


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



reply via email to

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