unix - Pass all parameters of one shell script to another -


i have shell script passing few parameters. test1.sh -a 1 -b 2 -c "one 2 three"

inside test1.sh calling shell script in below fashion. test2.sh $*

i want pass parameters test2, passed test1 , in same format (with double quotes etc). parameters passed test2 test2.sh -a 1 -b 2 -c 1 2 three doesnt work me. there way around can pass parameters same way passing test1.

thanks zabi

you need say:

test2.sh "$@" 

refer special parameters:

@

expands positional parameters, starting one. when expansion occurs within double quotes, each parameter expands separate word. is, "$@" equivalent "$1" "$2" .... if double-quoted expansion occurs within word, expansion of first parameter joined beginning part of original word, , expansion of last parameter joined last part of original word. when there no positional parameters, "$@" , $@ expand nothing (i.e., removed).

the manual says:

"$*" equivalent "$1c$2c...", c first character of value of ifs variable.

which explains result you're observing.


Comments

Popular posts from this blog

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

wordpress - (T_ENDFOREACH) php error -

Using django-mptt to get only the categories that have items -