上QQ阅读APP看书,第一时间看更新
Listing of array indexes
Arrays have indexes for indexing each of the elements. Ordinary and associative arrays differ in terms of index type.
Obtain the list of indexes in an array.
$ echo ${!array_var[*]}
Alternatively, we can also use the following command:
$ echo ${!array_var[@]}
In the previous fruits_value array example, consider the following command:
$ echo ${!fruits_value[*]} orange apple
This will work for ordinary arrays too.