Handling values with space while passing commandline argument from wrapper script in KSH

Hi there,

I have a wapper script which passes the argument from command prompt to inner script.. It works fine as long as the argument containing single word. But when value contains multiple word with space, not working as expected. I tried my best, couldn't find the reason. Gurus, pls. help me.
Here is the code snippet :

Wrapper.sh

#### Wrapper Begin #####
while getopts ":i:" OPTION 2>/dev/null
  do
     case "$OPTION" in
          i) inargI=$OPTARG;;
         \?) print "Usage: $0 -i <ini>"
             exit -1 ;;
      esac
done
echo "$inargI"
$inargI
#### Wrapper End #####


inner.sh

#### Inner Begin ####
while getopts ":i:j:" OPTION 2>/dev/null
  do
     case "$OPTION" in
          i) inargI=$OPTARG;;
          j) inargJ=$OPTARG;;
         \?) print "Usage: $0 -i <job.ini> -j <job2.ini>"
             exit -1 ;;
      esac
done
echo "i=$inargI"
echo "j=$inargJ"
#### Inner End ####

When I run the arguments with out space, it works fine.

$ wrapper.sh -i "inner.sh -i \"Macain\" -j \"Obama\" "
inner.sh -i "Macain" -j "Obama" 
i="Macain"
j="Obama"


But When I run with space , the results are not showing as expected.

$ wrapper.sh -i "inner.sh -i \"John Macain\" -j \"Barack Obama\" "
inner.sh -i "John Macain" -j "Barack Obama" 
i="John
j=


The expected result should be
i="John Macain"
j="Barack Obama"

Appreciate your help.

Thanks & Regards,
Kans.

Please wrap code in

```text
 ... 
```

tags.

eval "$inargI"

Hi cfajohnson,

Thanks a lot. It works. I will test with actual code and will come to you, if I face any issues on it... Thanks again for the prompt response. :b: