associative array - iterating over keys of indirect bash hash -
i writing script reads number of variables in config file. number of variables associative arrays. 1 or more of hashes need parsed @ runtime in order set number of session related parameters.
while can access values each key individually this:
declare -a $(echo $1) . /path-to-config/script.conf _hashid=$1 param=${_hashid_}[string] echo ${!param}
...i unable access keys themselves. i'd this:
declare -a $(echo $1) . /path-to-config/script.conf _hashref_=${1}[@] key in "${!_hashref_}" ; echo ${_hashref_[$key]} done
this sets $key value of each element. , other variations i've tried on haven't worked either. can explain me how iterate on keys when hash name dynamic?
Comments
Post a Comment