additional changes to avoid array subscript double expansion in arithmetic contexts

This commit is contained in:
Chet Ramey
2021-05-10 09:58:14 -04:00
parent 35bc7025c1
commit b304aabc92
15 changed files with 235 additions and 25 deletions
+1 -1
View File
@@ -493,7 +493,7 @@ declare -a a=([1]="2" [2]="3" [3]="4")
abcd
unset
./array21.sub: line 30: typeset: a: not found
./array21.sub: line 33: typeset: A: not found
declare -A A=([four]="4" [two]="2" [three]="3" [one]="1" )
declare -a a=()
declare -A A=()
declare -a foo=([0]="1" [1]="(4 5 6)" [2]="3")
+2 -3
View File
@@ -79,7 +79,6 @@ declare -A a=()
declare -A a=(["\$(echo foo)"]="1" )
declare -A a=()
declare -A a=(["\$(echo foo)"]="1" )
./quotearray3.sub: line 66: typeset: assoc: not found
1
./quotearray3.sub: line 71: \@: syntax error: operand expected (error token is "\@")
declare -A assoc=(["!"]="bang" )
0
1
+2
View File
@@ -62,9 +62,11 @@ key=@
assoc[@]=at
assoc[!]=bang
# this should only unset the element with key `@'
unset -v assoc[$key]
typeset -p assoc
# this doesn't work yet
test -v assoc[$key]
echo $?