使用
declare -A
(declare 的用法请使用 help 进行查看,help declare
) 进行声明关联数组变量;$ declare -A fruits_price $ fruits_price=([apple]='$100' [orange]='$150')
列出关联数组的索引(也就是 key):
$ echo ${!fruits_price[*]} $ echo ${!fruits_price[@]}
Linux shell —— 数组与关联数组
猜你喜欢
转载自blog.csdn.net/lanchunhui/article/details/80217447
今日推荐
周排行