I have the following
#!/bin/bash
function f1 ()
{
echo "${@:1:-2}"
}
f1 1 2 3 4 5 6
I need to echo 1 2 3 4 5
man bash
tells me that when I use @
I can't use a negative length.
I resorted to using a calculating ("${@:1:$((${#@}-1))}"
) which is seeming unorthodox to me.
How do I exclude the last parameter from outputting?