If we want to preserve (pass) the command line arguments when running a bash script and pass them to a program defined in the script, we can use the $*
pattern after the call. An example bash script called myscript.sh
is shown below. It sets some environment variables (optional) and starts a program called myserver
. The program will accept all command line args passed to the bash script as if they were passed to the myserver
program directly.
Calling the script like:
|
|
will be like calling the myserver program like:
|
|