I am on a mac and I can not use declare -A
.
I've looked at a few questions already
1) Bash 4 associative arrays: error "declare: -A: invalid option"
2) declare -A bash does not work on mac os x
Both refer to as upgrading to bash version 4.
So i've done brew install bash
and even updated my etc/shells
to update that to point to the bash that was installed by brew.
But the problem still exists.
Here is the outputs of my bash screen.
$ bash --version
GNU bash, version 4.4.12(1)-release (x86_64-apple-darwin16.3.0)
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
$ which bash
/usr/local/bin/bash
$ declare -A assoc_array=(["key1"]="value1" ["key2"]="value2")
-bash: declare: -A: invalid option
declare: usage: declare [-afFirtx] [-p] [name[=value] ...]
Thanks.