[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: mapfile creates poorly-named array if passed nameref to array subscr
From: |
Chet Ramey |
Subject: |
Re: mapfile creates poorly-named array if passed nameref to array subscript |
Date: |
Thu, 2 Jun 2016 21:01:53 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 |
On 6/1/16 6:19 PM, Grisha Levit wrote:
> |$ declare -n ref=XXX[0]; mapfile ref <<< $'1\n2'; declare -p XXX[0] declare
> -a XXX[0]=([0]=$'1\n' [1]=$'2\n') |
>
> maybe makes sense to check for legal identifier before making the array?
Actually, it makes sense to check only for legal identifier instead of
allowing array references for variable creation, sinec they should only
work for variable assignment.
--
``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/