Alex Rivera | Logout

Propagate all arguments in a Bash shell script

Asked 2011-01-28T03:34:04.250
1292

I am writing a very simple script that calls another script, and I need to propagate the parameters from my current script to the script I am executing.

For instance, my script name is foo.sh and calls bar.sh.

foo.sh:

bar $1 $2 $3 $4

How can I do this without explicitly specifying each parameter?

Edit
Report

1 Answer

532

For bash and other Bourne-like shells:

bar "$@"
answered 2010-07-06T23:00:15.463

Your Answer