I have two associative arrays as follows
P=([5]=0 [2]=1 [3]=2)
Q=([4]=0 [1]=5 [1]=3)
I have this loop that iterate over each element in P and each element in Q to correspond each element in P with all element in Q, as follows
for i in ${!P[@]}; do
for j in ${!Q[@]}; do
echo ${P[i]}
echo "-"
echo ${Q[j]}
echo "-----------"
done
done
The expected output would be
1
-
3
-----------
1
-
0
----------- ################# it skips that
1
-
5
----------- #################
2
-
3
-----------
2
-
0
----------- ################# it skips that
2
-
5
----------- #################
0
-
3
-----------
0
-
0
----------- ################# it skips that
0
-
5
----------- #################
but it skips one element from the second array, which is 5.