二、关联数组
关联数组是如何定义的那? 切记 先声明关联数组
方法一: 一次赋一个值
数组名[索引]=变量值
方法一:
# declare -A array2
# array2[index1]=pear
# array2[index2]=apple
# array2[index3]=orange
# array2[index4]=peach
查看
[root@localhost ~]# echo ${array2[@]}
peach pear apple orange
方法二: 一次赋多个值
# declare -A array2
# array2=([index1]=tom [index2]=jack [index3]=alice [index4]='bash shell')
查看数组
declare -A | grep array2
declare -A(这个是查看全部)
删除数组
unset array[ xx ] (填写要删除的索引)