Bash“declare -A”不适用于macOS

时间:2014-11-18 19:16:41

标签: linux bash macos associative-array

我猜是Bash没有在macOS上更新。当谷歌搜索更新Bash macOS时,我不断收到错误修复补丁。无论如何,我需要在macOS Bash中使用关联数组,命令:

declare -A

产生错误:

  

-bash:声明:-A:无效选项
  声明:用法:声明[-afFirtx] [-p] [name [= value] ...]

我有优胜美地。

1 个答案:

答案 0 :(得分:6)

declare -A(关联数组)是一个bash 4+功能。

OS X bash可能是3.X。

我不知道OS X有bash 4 +的官方更新。

冲泡/等。可能会。