How to remove first bash argument and pass the others to another command?

bash, parameter-passing

Solution

You can use `shift` to shift the argument array. For instance, the following code:

#!/bin/bash
echo $@
shift
echo $@

produces, when called with `1 2 3` prints `1 2 3` and then `2 3`:

$ ./example.sh 1 2 3
1 2 3
2 3

Problem

In bash `$@` contains all the arguments used to call the script but I am looking for a solution to remove the first one ``` ./wrapper.sh foo bar baz ...: #!/bin/bash # call `cmd` with bar baz ... (withouyt foo one) ``` I just want to call `cmd bar baz ...`

Original source

Related problems