You can skip positional parameters with shift
but can you delete positional parameters by passing the position?
x(){ CODE; echo "$@"; }; x 1 2 3 4 5 6 7 8
> 1 2 4 5 6 7 8
I would like to add CODE to x()
to delete positional parameter 3. I don't want to do echo "${@:1:2} ${@:4:8}"
. After running CODE, $@
should only contain "1 2 4 5 6 7 8".