I have an array tokens which contains tokens=( first one two three last ). How do I obtain the values ( one two three ) if I do not know how many numbers are in the array? I want to access everything between first and last (exclusive).
echo ${tokens[*]:1:3}
will give one two three but if I do not know the length of the array how can I get all the elements after first and before last? I am looking for something similar to using negative indices in Python such as tokens[1:-1]