1.shell界面或脚本中
pcode=(["10"]="BeiJing" ["22"]="TianJin")
echo ${pcode["22"]} ==》 TianJin
2.脚本中
declare -A mydict
mydict=(["hometown"]="CHINA" ["name"]="Judy" ["age"]="27" ["hobby"]="swimming")
echo ${mydict[age]} ==> 27
1.shell界面或脚本中
pcode=(["10"]="BeiJing" ["22"]="TianJin")
echo ${pcode["22"]} ==》 TianJin
2.脚本中
declare -A mydict
mydict=(["hometown"]="CHINA" ["name"]="Judy" ["age"]="27" ["hobby"]="swimming")
echo ${mydict[age]} ==> 27
转载于:https://www.cnblogs.com/sayhihi/p/7905070.html