-
- 声明Map
- declare -A testMap
-
- 赋值
- testMap[“one”]=“001”
- testMap[“two”]=“002”
- testMap[“three”]=“003”
-
- 输出
- 输出值 ${testMap[“two”]}
- 输出key ${!testMap[@]}
- 输出value ${testMap[@]}
- 遍历
for key in ${!testMap[*]};
do
echo $key
echo ${testMap[$key]}
done
2024-02-07 20:10:17
for key in ${!testMap[*]};
do
echo $key
echo ${testMap[$key]}
done