Getting all elements of a bash array except the first
If it's a standard array, use:
"${a[@]:1}"
If you're working with parameters:
"${@:2}"
Note the different syntax and that $@
is 1-indexed (since $0 is the name of the script).
$ a=(1 2 3)
$ echo "${a[@]:1}"
2 3