summaryrefslogtreecommitdiff
path: root/tests/array11.sub
diff options
context:
space:
mode:
authorChet Ramey <chet.ramey@case.edu>2011-12-29 13:09:08 -0500
committerChet Ramey <chet.ramey@case.edu>2011-12-29 13:09:08 -0500
commit7fc96f7961ec44a2dae33face111b0a464c2ec33 (patch)
tree51ff8f6bf7bc15f17ce39584874859ebda2dc7d8 /tests/array11.sub
parent276cb932b6494ef32c817752ac4882ce42f37ef4 (diff)
downloadbash-7fc96f7961ec44a2dae33face111b0a464c2ec33.tar.gz
commit bash-20110608 snapshot
Diffstat (limited to 'tests/array11.sub')
-rw-r--r--tests/array11.sub29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/array11.sub b/tests/array11.sub
new file mode 100644
index 00000000..87cf0115
--- /dev/null
+++ b/tests/array11.sub
@@ -0,0 +1,29 @@
+# problems with associative array keys with ] and unbalanced [ ]
+# fixed after bash-4.2
+
+declare -A foo
+
+foo=(["version[agent]"]=version.agent)
+
+echo ${!foo[@]}
+echo ${foo[@]}
+
+unset foo
+declare -A foo
+foo["version[agent]"]=version.agent
+
+echo ${!foo[@]}
+echo ${foo[@]}
+
+declare foo["foo[bar]"]=bowl
+
+echo ${!foo[@]}
+echo ${foo[@]}
+
+declare -A array2["foo[bar]"]=bleh
+
+array2["foobar]"]=bleh
+array2["foo"]=bbb
+
+echo ${!array2[@]}
+echo ${array2[@]}