I should note also that the behavior when inside a function matches exactly
what the manual says. It’s the global namerefs that have this unexpected
behavior of following the chain to the end and and modifying only the last
nameref in the chain.

The only buggy behavior when inside of functions (ignoring scope issues)
seems to be that `declare -n ref’ unsets the value of $ref if it previously
pointed to a variable that is unset.

$ f() { unset var; declare -n ref=var; declare -n ref; declare -p ref;
}; fdeclare -n ref     # why did the value of ref disappear?

$ f() { local var; declare -n ref=var; declare -n ref; declare -p ref;
}; fdeclare -n ref="var"

​

Reply via email to