If I want to print the content from item 13 to the second last item in the array, and I don't know how long the array will be, how will this be done with BASH?
for array_element in `seq 13 $(({myarray[@]-1))` do echo ${myarray[array_element]} done
Since you are using bash , don't use seq . Use a C loop instead.
bash
seq
for ((i=13; i < ${#myarray[@]} - 1; i++)); do echo ${myarray[i]} done
You can do it like this:
for array_element in `seq $((${#myarray[@]}-1))` do echo ${myarray[$((array_element-1))]} done