#!/bin/bashecho "shell定义字典"#必须先声明declare -A dicdic=([key1]="value1" [key2]="value2" [key3]="value3")#打印指定key的valueecho ${dic["key1"]}#打印所有key值echo ${!dic[*]}#打印所有valueecho ${dic[*]}#遍历key值for key in $(echo ${!dic[*]})do echo "$key : ${dic[$key]}"doneecho "shell定义数组"