原文出自:http://blog.csdn.net/xzw_123/article/details/42920371 定义一个空map [plain] view plain copy declare -A map=() 定义时初始化map [plain] view plain copy declare -A map=(["100"]="1" ["200"]="2") 输出所有key [plain] view plain copy echo ${!map[@]} 输出所有value [plain] view plain copy echo ${map[@]} 添加值 [plain] view plain copy map["300"]="3" 输出key对应的值 [plain] view plain copy echo ${map["100"]} 遍历map [plain] view plain copy for key in ${!map[@]} do echo ${map[$key]} done