0
我想一个数组传递到一个函数和数组做任何的改变体现在功能如何通过数组功能和更新阵列反射的外部功能
function update_array()
{
${1[0]}="abc" # trying to change zero-index array to "abc" ,
# bad substitution error
}
foo=(foo bar)
update_array foo[@]
for i in ${foo[@]}
do
echo "$i" # currently changes are not reflected outside the function
done
我的问题是
外1)如何访问索引数组如:零指数阵列,在功能上,什么是它
2)我如何更改此指数数组的语法,这样的变化是outsite反映该功能也是
谢谢你是我寻找的答案!真的很欣赏它嘿嘿 – Computernerd