On Tue, Apr 6, 2021 at 11:28 PM Robert Elz <k...@munnari.oz.au> wrote: > | @ means everything or nothing. Unbound variable errors should not apply > to it. > > I know nothing about namerefs and arrays and stuff like that, > but did you consider the possibility that after > > array=() > > then > > array[@] > > is nothing, and so > > __ref=array[@] > > is just > > __ref= > > and consequently ${!__ref} is attempting to use '' as the name of a > variable?
References are virtually like placeholders and don't expand the referenced target themselves. ${!__ref} is synonymous to ${array[@]}, not ${${array[@]}}. This is why you can do other parameter expansion features like ${!var+.} ${!var@a}. -- konsolebox