On 3/11/21 3:50 PM, Andreas Schwab wrote:
On Mär 11 2021, Chet Ramey wrote:

$ cat x1
declare -A blah
blah['$(DOESNOTEXIST)']=broken
shopt -s assoc_expand_once
   touch blah\$
for i in "${!blah[@]}"; do unset blah["$i"]; done
declare -p blah
$ ../bash-5.1-patched/bash ./x1
declare -A blah=()

Sure:

"When  using  a  variable name with a subscript as an argument to a com-
 mand, such as with unset, without using the word expansion  syntax  de-
 scribed above, the argument is subject to pathname expansion.  If path-
 name expansion is not desired, the argument should be quoted."


--
``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/

Reply via email to