On Thu, Jun 27, 2024 at 9:12 AM Zachary Santer <zsan...@gmail.com> wrote: > > This, though I would add the caveat that 'set -u'/'set -o nounset' > should cause this expansion to fail and the script to error out if you > supply an index without a matching value.
> And I guess my "${array[@]( index )}" would give the same behavior as > your "${array[@][index]}". Though "${array[@]}" doesn't result in an error with 'set -u' when array is empty. Which is good. I'm not complaining about that. Given that, you might want the same behavior from "${array[@]( index )}", which would of course still apply when you are providing multiple indices. Not sure of the best way this would work.