• 使用 declare -A(declare 的用法请使用 help 进行查看,help declare) 进行声明关联数组变量;

    $ declare -A fruits_price
    $ fruits_price=([apple]='$100' [orange]='$150')
  • 列出关联数组的索引(也就是 key):

    $ echo ${!fruits_price[*]}
    $ echo ${!fruits_price[@]}

相关文章:

  • 2022-12-23
  • 2021-12-11
  • 2021-06-22
  • 2021-07-15
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-01-14
  • 2022-12-23
  • 2023-02-16
  • 2021-09-27
  • 2022-12-23
  • 2021-07-13
  • 2022-12-23
相关资源
相似解决方案