arr=( ) implies no [0]= On Mon, Apr 5, 2021, 22:46 konsolebox <konsole...@gmail.com> wrote:
> set -u > array=() > __ref=array[@] > : "${array[@]}" # Reports nothing > : "${!__ref}" # Unbound variable > > Using bash version 5.1.4. I know this can be avoided by using namerefs > instead but indirection is more portable when no assignment is needed > and this sometimes allows my portable functions to have less versions. > > The detection of unbound variables seem to have become more reasonable > since 5.0 and I hope it gets improved further. I don't use set -u in > older bash and it's only for development mode. > > -- > konsolebox > >