I am trying to create a bash script which passes its own argument onto a python script. I want it to work like this.
If I run it as this:
python script.py latest
python script.py 123
In this case the trick is to pass however many arguments you have, including the case where there are none, and to preserve any grouping that existed on the original command line.
So, you want these three cases to work:
script.sh # no args script.sh how now # some number script.sh "how now" "brown cow" # args that need to stay quoted
There isn't really a natural way to do this because the shell is a macro language, so they've added some magic syntax that will just DTRT.
#!/bin/sh python script.py "$@"