I am trying to loop through an array and add a prefix to each value in the array. Simplified version of the code:
#!/bin/sh
databases=( db1 db2 db3 )
for i in live_${databases[@]} stage_${databases[@]}
do
....
done
However, it only adds a prefix to the first value in the array - the values ββit executes are as follows:
live_db1 db2 db3 stage_db1 db2 db3
Any thoughts? Thank.
source
share