linux关联数组的增删改查操作
arrays=(one two three four)
echo ${arrays[@]/o/k}
kne twk three fkur
echo ${arrays[@]/%o/k}
one twk three four
echo ${arrays[@]/#o/k}
kne two three four
echo ${arrays[@]/o/}
ne tw three fur
echo ${arrays[@]:0:2}
one two
aa=(a b c)
unset aa[1]
echo ${aa[@]}
a c
declare -A mydict=(["name"]=cxm ["age"]=31)
echo ${mydict["name"]}
cxm
echo ${mydict["age"]}
31
获取索引字段 格式: ${!关联数组名[@或*]}
echo ${!mydict[@]}
name age
删除关联数组
unset mydict