Re: nameref subscript assignment with unset target var

2016-05-23 Thread Chet Ramey
On 5/22/16 6:43 PM, Grisha Levit wrote: > This multiple-vars-at-same-scope thing happens also happens in the case > that the nameref points to a variable at a higher scope of the same name as > the nameref. I suspect this is related to the nameref resolution issue here > http://lists.gnu.org/archiv

Re: nameref subscript assignment with unset target var

2016-05-22 Thread Grisha Levit
This multiple-vars-at-same-scope thing happens also happens in the case that the nameref points to a variable at a higher scope of the same name as the nameref. I suspect this is related to the nameref resolution issue here http://lists.gnu.org/archive/html/bug-bash/2016-05/msg00115.html Given a f

Re: nameref subscript assignment with unset target var

2016-05-18 Thread Chet Ramey
On 5/17/16 4:40 PM, Grisha Levit wrote: > Multiple variables with the same name are created at the same scope when > doing assignments to subscripts of nameref variables that point to > variables that are unset. > > |$ unset var; declare -n ref=var; ref[0]=foo $ declare -p ref declare -a > ref=([0

nameref subscript assignment with unset target var

2016-05-17 Thread Grisha Levit
Multiple variables with the same name are created at the same scope when doing assignments to subscripts of nameref variables that point to variables that are unset. $ unset var; declare -n ref=var; ref[0]=foo $ declare -p refdeclare -a ref=([0]="foo") I think the more reasonable thing would be t