Re: array subscripts act differently for integers(ie. let)
From:
Chet Ramey
Subject:
Re: array subscripts act differently for integers(ie. let)
Date:
Wed, 18 Feb 2015 15:54:36 -0500
User-agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.4.0
On 2/18/15 3:49 PM, Maarten Billemont wrote:
> > also this variant does the same:
> > $ (('ar[$idbad2]+=11'))
>
>
> Because (( and let are essentially equivalent.
>
>
> I think the more important question isn't "why does (( behave this way?",
> but rather "should (( behave this way?".
>
> It's probably not reasonable to expect the author to know and take into
> account that (( arr[$key] )) treats key's data as bash code.
What does `bash code' mean? It undergoes the usual set of word expansions.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/