bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: nameref subscript assignment with unset target var


From: Grisha Levit
Subject: Re: nameref subscript assignment with unset target var
Date: Sun, 22 May 2016 18:43:03 -0400

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 function:

f() { local -n a=$1; a=X; }

The following works as expected:

$ a=(0); f 'a'
$ while [[ -v a ]]; do declare -p a; unset a; done
declare -a a=([0]="X")

But the following does something strange:

$ a=(0); f 'a[0]'
$ while [[ -v a ]]; do declare -p a; unset a; done
declare -a a=([0]="X")
declare -a a=([0]="0")

reply via email to

[Prev in Thread] Current Thread [Next in Thread]