Re: Difference between assignment via nameref vs `printf -v`?
From:
Chet Ramey
Subject:
Re: Difference between assignment via nameref vs `printf -v`?
Date:
Mon, 01 Sep 2014 21:02:27 -0400
User-agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.6.0
On 8/31/14, 12:20 AM, lolilolicon wrote:
> Assignment to a subscripted array variable behaves differently for
> nameref vs `printf -v`, as shown below.
[...]
> Is subscripted array variable allowed as argument to `declare -p` in bash?
> A quick test seems to suggest it's not -- consistent with the `printf
> -v` behavior.
>
> Is there a legitimate explanation for this?
It's a bug that results in `arr[0]' being created as a shell variable.
I've attached a patch for people who want to experiment with it.
Chet
--
``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/