(bash noobie here)
In bash I am successful creating an array with database tables and then looping through them. I want to declare this array at the top of my script and then assign it later to another variable.
my_databases=(value1 value2 value3)
Looping through this works fine with for i in "${my_databases[@]}"
The problem is here:
Instead of looping through my_databases
I have a step in between and I want to assign the array to a variable new_array
.
new_array=$my_databases
Now when I loop through this new_array
, the script fails after the first array value.
How can I assign a declared array to a new variable correctly?