声明字典变量dict declare -A dict 定义字典 dict=([key1]=a [key2]=b [key3]=c) 查询字典 echo ${dict[key1]} 参考资料: [1] [Shell]字典的使用 [博客园]