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 test
你可以像这样回显值
i=2 echo ${test[i]}
或者
i="1+1" echo ${test[i]}
为什么接受第二种形式?我需要一个复杂的答案谢谢
见man bash:
man bash
下标被视为必须计算为数字的算术表达式。
够复杂吗?