I would like to pass all script arguments to the foo function, and if the first argument is something, pass all the rest arguments to the bar function.
I implemented this like that:
foo() {
if [ "$1" = 'something' ]; then
args=("$@")
unset args[0]
bar $args
fi
}
foo $@
Is that possible to simplify this?
Yes, use
shift