I've been working with bash more and more on my Mac and have discovered that for some reason the declare -A command does not work.
myname$ declare -A
-bash: declare: -A: invalid option
declare: usage: declare [-afFirtx] [-p] [name[=value] ...]
This answer says that support for associate arrays was added to bash in version 4.
When I run bash --version
I get 5.0.11.
myname$ bash --version
GNU bash, version 5.0.11(1)-release (x86_64-apple-darwin18.6.0)
Copyright (C) 2019 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.
[1]: https://unix.stackexchange.com/a/428205/379464
I ran bash --version and echo $BASH_VERSION as @chepner recommended and they give different answers.
bash --version
GNU bash, version 5.0.11(1)-release (x86_64-apple-darwin18.6.0)
Copyright (C) 2019 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.
SEGON207127:gnubin nberkowitz$ echo $BASH_VERSION
3.2.57(1)-release
I've already run brew install gnutils
and added it to PATH in .bashrc
.
Anything else I should try?