This script does what you want:
#!/bin/bash
a=( 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 )
rows=5
for (( j=0; j<rows; ++j )); do
for (( i=0; i<=$(( ${#a[@]} / rows )); ++i )); do
if (( i%2 )); then idx=$(( (i + 1) / 2 * 2 * rows - j - 1 ))
else idx=$(( (i / 2) * 2 * rows + j )); fi
printf "%-4s" "${a[idx]}"
done
printf "\n"
done
Output:
1 10 11
2 9 12
3 8 13 18
4 7 14 17
5 6 15 16
To make it work from left to right rather than from top to bottom, you can simply swap the i and j loops around (and change the name rows to cols so that it still makes sense):
#!/bin/bash
a=( 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 )
cols=5
for (( i=0; i<=$(( ${#a[@]} / cols )); ++i )); do
for (( j=0; j<cols; ++j )); do
if (( i%2 )); then idx=$(( (i + 1) / 2 * 2 * cols - j - 1 ))
else idx=$(( (i / 2) * 2 * cols + j )); fi
printf "%-4s" "${a[idx]}"
done
printf "\n"
done
Output:
1 2 3 4 5
10 9 8 7 6
11 12 13 14 15
18 17 16