Bash: all of array except last element

Viewed 7864

Bash has a neat way of giving all elements in an array except the first:

"${a[@]:1}"           

To get all except the last I have found:

"${a[@]:0:$((${#a[@]}-1))}"

But, man, that is ugly.

Is there an elegant alternative?

1 Answers
Related