Let us say, i have an array:
versions=(1 2 3 4)
I can iterate over it by :
for i in ${versions[@]}
How to do this if the name of the array is decided on the basis of some other variable, hence stored in a variable
Example:
array_name=${some_var}_arr
declare -a ${array_name}
How do I iterate over elements of array whose name is stored in array_name. I tried
for i in ${${array_name}[@]}
Got bad substitution error