I create an array with a comma for delimiter:
echo "${myarray[*]}"
# prints: 22,3,2,0,22,4,5,8,22,4,3,6
I’d like to print it to terminal in chunks of four, with a newline and no comma before newline. like:
22,3,2,0
22,4,5,8
22,4,3,6
I’ve been struggling trying to get for loops to work with it like:
for i in {0..${#myarray[@]}..4} do
##tried lots of things that didn't work here
done
Can someone point me in the right direction or how to think about it? Please and thank you.