I want to escape the first string SOMETEXT
in the getopts
args. But I'm only able to do it in the first example.
How can I make it work on the second example?
while getopts p: opt
do
case $opt in
p) result=$OPTARG;;
esac
done
echo "The result is $result "
Example 1:
run_test.ksh -p3 SOMETEXT
The result is 3
Example 2:
run_test.ksh SOMETEXT -p3
./run_test.ksh: line 10: result: parameter not set