So if I have a bash array:
ar=( "one" "two" "three" "four")
What is the best way to make a new array such that it looks like this:
ar-new=( "one" "one two" "one two three" "one two three four" )
I cooked up something that use a for loop inside a for loop and using seq
. Is there a better/more elegant way to accomplish this?