pass arguments between shell scripts but retain quotes pass arguments between shell scripts but retain quotes shell shell

pass arguments between shell scripts but retain quotes


Use "$@" instead of $* to preserve the quotes:

./script2.sh "$@"

More info:

http://tldp.org/LDP/abs/html/internalvariables.html

$*
All of the positional parameters, seen as a single word

Note: "$*" must be quoted.

$@
Same as $*, but each parameter is a quoted string, that is, the parameters are passed on intact, without interpretation or expansion. This means, among other things, that each parameter in the argument list is seen as a separate word.

Note: Of course, "$@" should be quoted.