2

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

1
  • thanks @MarkReed, got the solution at the link Commented Apr 18, 2016 at 12:26

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.