-
使用
declare -A(declare 的用法请使用 help 进行查看,help declare) 进行声明关联数组变量;$ declare -A fruits_price $ fruits_price=([apple]='$100' [orange]='$150') -
列出关联数组的索引(也就是 key):
$ echo ${!fruits_price[*]} $ echo ${!fruits_price[@]}
相关文章:
使用 declare -A(declare 的用法请使用 help 进行查看,help declare) 进行声明关联数组变量;
$ declare -A fruits_price
$ fruits_price=([apple]='$100' [orange]='$150')
列出关联数组的索引(也就是 key):
$ echo ${!fruits_price[*]}
$ echo ${!fruits_price[@]}
相关文章: