I want to pass along the command line arguments given to script to another command, but I also want to add some additional arguments on the front first. How can I do this with bash?
This will send all the arguments through to the command:
command $@
But I want something more like:
command [argument1, argument2, $@]
How can you do something like this in bash?
@ThatOtherGuy's answer is correct.
If you were looking to "unshift" a couple of arguments into the positional parameters, do this:
set -- arg1 arg2 "$@"
cmd "$@"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With