mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-07-08 21:00:48 +02:00
commit bash-20201214 snapshot
This commit is contained in:
@@ -223,6 +223,14 @@ declare -A a=(["80's"]="Depeche Mode" )
|
||||
declare -A a=(["\$(date >&2)"]="5" )
|
||||
declare -A myarray=([foo]="bleh" ["foo[bar"]="bleh" )
|
||||
foo
|
||||
declare -A assoc=(["\$var"]="value" )
|
||||
declare -A assoc=(["\$var"]="value" )
|
||||
declare -A assoc=(["\$var"]="value" )
|
||||
declare -A assoc=()
|
||||
./assoc9.sub: line 154: typeset: `foo[foo]bar]=bax': not a valid identifier
|
||||
foo]bar
|
||||
bip
|
||||
declare -A foo=(["foo]bar"]="bip" )
|
||||
./assoc10.sub: line 14: declare: a: cannot convert indexed to associative array
|
||||
f: declare -a a
|
||||
./assoc10.sub: line 17: declare: a: cannot convert associative to indexed array
|
||||
|
||||
@@ -128,3 +128,32 @@ aa[$key]=foo
|
||||
echo "${aa[$key]}"
|
||||
|
||||
[[ -v aa[$key] ]] || echo bad assoc expansion
|
||||
|
||||
shopt -u assoc_expand_once
|
||||
|
||||
declare -A assoc
|
||||
|
||||
var=x123
|
||||
assoc['$var']=value
|
||||
|
||||
declare -p assoc
|
||||
|
||||
unset "assoc[$var]"
|
||||
declare -p assoc
|
||||
|
||||
unset 'assoc[$var]'
|
||||
declare -p assoc
|
||||
|
||||
shopt -s assoc_expand_once
|
||||
unset 'assoc[$var]'
|
||||
declare -p assoc
|
||||
|
||||
typeset -A foo
|
||||
|
||||
foo["foo]bar"]=bip
|
||||
typeset foo["foo]bar"]=bax
|
||||
|
||||
echo ${!foo[@]}
|
||||
echo ${foo[@]}
|
||||
|
||||
declare -p foo
|
||||
|
||||
Reference in New Issue
Block a user