array11.sub 516 B

123456789101112131415161718192021222324252627282930313233343536
  1. # problems with associative array keys with ] and unbalanced [ ]
  2. # fixed after bash-4.2
  3. declare -A foo
  4. foo=(["version[agent]"]=version.agent)
  5. echo ${!foo[@]}
  6. echo ${foo[@]}
  7. unset foo
  8. declare -A foo
  9. foo["version[agent]"]=version.agent
  10. echo ${!foo[@]}
  11. echo ${foo[@]}
  12. declare foo["foo[bar]"]=bowl
  13. echo ${!foo[@]}
  14. echo ${foo[@]}
  15. declare -A array2["foo[bar]"]=bleh
  16. array2["foobar]"]=bleh
  17. array2["foo"]=bbb
  18. echo ${!array2[@]}
  19. echo ${array2[@]}
  20. declare -A foo
  21. foo=( ['ab]']=bar )
  22. echo ${!foo[@]}
  23. echo ${foo[@]}