重击"declare -A"在macOS上不起作用 [英] Bash "declare -A" does not work on macOS
本文介绍了重击"declare -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] [名称[=值] ...]
-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+.
酿造/等.可能会.
这篇关于重击"declare -A"在macOS上不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文