I am having a parent script and a child script,
Parent script:
echo 'Parent script 1st arg '$1
echo 'Parent script 2nd arg '$2
PARAMS=$*
ksh child_script.ksh $PARAMS
Child script:
echo 'Child script 1st arg '$1
echo 'Child script 2nd arg '$2
I am executing the parent script by passing two argument as below
ksh parent_script.ksh ABC 'DEF XYZ'
I am getting the output as,
Parent script 1st arg ABC
Parent script 2nd arg DEF XYZ
Child script 1st arg ABC
Child script 2nd arg DEF
I want to pass DEF XYZ as a single argument which is why I enclosed in single quotes and passed the same. It is considered as a single argument by the parent script. Later, when it is assigned using $* the grouping of words is not preserved. Rather it is getting passed as two different argument. Please advice why the arguments are not passed as it is and is there any way to correct it?
Expected output,
Parent script 1st arg ABC
Parent script 2nd arg DEF XYZ
Child script 1st arg ABC
Child script 2nd arg DEF XYZ