Re: Indices of array variables are sometimes considered unset (or just d
From:
Grisha Levit
Subject:
Re: Indices of array variables are sometimes considered unset (or just display an error).
Date:
Tue, 6 Nov 2018 01:03:30 -0500
On Mon, Nov 5, 2018 at 10:38 PM Eduardo Bustamante <dualbus@gmail.com>
wrote:
> Sorry, I'm having a hard time following this email thread.
I *think* the point is that OP expected that:
(a) ${!var[@]-foo} expands to the indexes of var if ${var[@]} if set, else
to `foo'
whereas the behavior they observed is:
(b) ${!var[@]-foo} expands to the value of the variable whose name is
stored
in ${var[@]} or to `foo' if that variable is unset
Their expectation seems reasonable since "the variable whose name is stored
in ${var[@]}" is kind of a weird thing.