On Tue, Jun 13, 2023, 22:21 Chet Ramey <chet.ra...@case.edu> wrote: > The latest push to the devel branch extends the assoc_expand_once > semantics to indexed array variables. This means that a construct > like > > export subscript='$(uname >&2 ; echo 0)' > shopt -s assoc_expand_once > printf -v a["$subscript"] %s hi > declare -p a > > will no longer run `uname' and assign "hi" to subscript 0. This affects > shell builtins that take array references as arguments, which undergo one > round of word expansion before the builtin performs the assignment. > > The affected builtins are primarily > > printf > read > wait > > since those assign values to variable names passed as arguments. > > The option also affects > > declare > let > local > typeset > test > [ > unset > > For example, the following does not run `uname': > > export subscript='$(uname >&2 ; echo 0)' > shopt -s assoc_expand_once > let a["$subscript"]+=1 > > To better describe its functionality, I renamed assoc_expand_once to > array_expand_once. The old name is still accepted. >
any word s about [[ -v .. ? greets When the next version of bash is released, the old bash-5.2 behavior (that > runs `uname' in the above examples) will be available if the shell > compatibility level is set to 52 or lower. > > Chet > > -- > ``The lyf so short, the craft so long to lerne.'' - Chaucer > ``Ars longa, vita brevis'' - Hippocrates > Chet Ramey, UTech, CWRU c...@case.edu http://tiswww.cwru.edu/~chet/ > >