Re: namerefs and environment variable names with subscripts

2018-07-18 Thread Chet Ramey
On 7/17/18 4:44 PM, Grisha Levit wrote: > The following commands: > > declare -n r=v[0] > v=(X); r=Y > declare -p ${!v*} > printf "%s: <%s>\n" "r" "$r" "v" "$v" > > Will normally produce the following output: > > declare -a v=([0]="Y") > r: > v: > > However, if we

namerefs and environment variable names with subscripts

2018-07-17 Thread Grisha Levit
The following commands: declare -n r=v[0] v=(X); r=Y declare -p ${!v*} printf "%s: <%s>\n" "r" "$r" "v" "$v" Will normally produce the following output: declare -a v=([0]="Y") r: v: However, if we start bash with `v[0]' already in the environment, such as with: