Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
使用 声明数组有什么好处declare -a?
declare -a
例如; usingdeclare -a foo=(a b c)比 using 有什么好处foo=(a b c)吗?
declare -a foo=(a b c)
foo=(a b c)
当您declare在 bash 中使用变量时,它会成为本地范围。local这与使用内置函数相同。在范围界定之外,没有任何好处。必须在 bash 中声明的唯一变量是带有-A.
declare
local
-A