Bash“声明-A"不适用于 macOS [英] Bash "declare -A" does not work on macOS
本文介绍了Bash“声明-A"不适用于 macOS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的猜测是 Bash 没有在 macOS 上更新.当谷歌搜索更新 Bash macOS 时,我不断收到错误修复补丁.无论如何,我需要在 macOS Bash 中使用关联数组,其中命令:
My guess is that Bash is not updated on macOS. When googling update Bash macOS, I keep getting the bug fix patch. Anyway, I need to use associative arrays in macOS Bash where the command:
declare -A
产生错误:
-bash:声明:-A:无效选项
声明:用法:声明 [-afFirtx] [-p] [name[=value] ...]
-bash: declare: -A: invalid option
declare: usage: declare [-afFirtx] [-p] [name[=value] ...]
我有优胜美地.
推荐答案
declare -A
(关联数组)是 bash 4+ 的特性.
declare -A
(associative arrays) are a bash 4+ feature.
OS X bash 可能是 3.X.
The OS X bash is likely 3.X.
我不知道 OS X 有针对 bash 4+ 的官方更新.
I don't know that OS X has an official update for bash 4+.
酿造/等.可能会.
这篇关于Bash“声明-A"不适用于 macOS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文