Array - Get last element of an array in linux shell
In this article we learn about how to get last element of an array in linux shell in linux terminal.
We can use negative index:
1 arr=( usdt btc eos )
2 echo "${arr[-1]}"
1 arr=( usdt btc eos )
2 echo "${arr[-2]}"