当我编写一个名为 array_call_self.sh 的脚本时,如下所示
#!/bin/bash
declare -A num word
word=(
[a]='index_a'
[b]='index_b'
[c]='index_c'
)
num=(
[a]=1
[b]=2
[c]=3
)
array=${$1[@]}
for i in ${$array[@]};do
echo $i
done
当我运行bash array_call_self.sh word
它时返回我
test.sh: line 13: ${$1[@]}: bad substitution
test.sh: line 14: ${$array[@]}: bad substitution