On Mon, Mar 29, 2021, at 8:01 PM, Peng Yu wrote:
> In this example, the changes to the
> associative array x within the loop does not affect the enumeration of
> the keys of x?
Why would it? The parameter expansion "${!x[@]}" is substituted
before the loop is run and cannot be changed after the fact. The
array is not consulted on each iteration.
$ declare -A x=([a]= [b]= [c]=)
$ printf '<%s>' "${!x[@]}"; echo
<c><b><a>
--
vq