How can I loop over two array values at a time? I tried using a for loop but I could only figure out how to echo one at a time.
#!/bin/bash
array=(value1 value2 value3 value4 value5 value6 value7 value8 value9 value10)
for i in ${array[@]}
do
echo $i
done
Is there a way to change the for loop that it will echo two values at a time like below?
value1 value2
value3 value4
value5 value6
value7 value8
value9 value10
echo ${array2[$j]}; j=$((j+1)).