I have the following situation, two arrays, let's call them A( 0 1 ) and B ( 1 2 ), i need to combine them in a new array C ( 0:1 0:2 1:1 1:2 ), the latest bit i've come up with is this loop:
for ((z = 0; z <= ${#A[@]}; z++))
do
for ((y = 0; y <= ${#B[@]}; y++))
do
C[$y + $z]="${A[$z]}:"
C[$y + $z + 1]="${B[$y]}"
done
done
But it doesn't work that well, as the output i get this:
0: : : :
In this case the output should be 0:1 0:2 as A = ( 0 ) and B = ( 1 2 )