array.md 删除数组元素
eagleoflqj opened this issue · 1 comments
eagleoflqj commented
如果对数组元素赋值空字符串,不能起到删除元素的效果
a=(x y z)
a[1]=''
declare -p a
echo ${#a[@]} # 还是3
echo ${!a[@]} # 0 1 2ruanyf commented
谢谢指出,已经改正。
eagleoflqj opened this issue · 1 comments
如果对数组元素赋值空字符串,不能起到删除元素的效果
a=(x y z)
a[1]=''
declare -p a
echo ${#a[@]} # 还是3
echo ${!a[@]} # 0 1 2谢谢指出,已经改正。