Suppose I have two scripts, printargs.sh:
#!/bin/bash
echo 1=$1
echo 2=$2
echo 3=$3
and passargs.sh:
#!/bin/bash
arg1="-e \"hello there\""
./printargs.sh $arg1
How do I modify passargs.sh to pass two arguments, -e and hello there, to printargs.sh? i.e. I would like printargs.sh to print
1=-e
2=hello there
3=
I feel like this question has plagued me for years! The only way I can get it is by creating two variables. Any help would be greatly appreciated.
The answer has been around for years.