系统相关
首页 > 系统相关> > Shell中Map用法

Shell中Map用法

作者:互联网

  1. 声明Map
    declare -A testMap
  2. 赋值
    testMap[“one”]=“001”
    testMap[“two”]=“002”
    testMap[“three”]=“003”
  3. 输出
    输出值    ${testMap[“two”]}
    输出key    ${!testMap[@]}
    输出value   ${testMap[@]}
  4. 遍历
for key in ${!testMap[*]};
do
	echo $key
	echo ${testMap[$key]}
done

标签:Map,Shell,输出,testMap,two,用法,key,echo
来源: https://blog.csdn.net/zengxingyuluo/article/details/101065479