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: optdo   case $opt in   p) result=$OPTARG;;   esacdoneecho The result is  $result Example 1:run_test.ksh -p3 SOMETEXTThe result is  3Example 2:run_test.ksh SOMETEXT -p3./run_test.ksh: line 10: result: parameter not set
parsing getopts
getopts
This is a consequence of using getopts. Parameters and their arguments must come before any other text.If you know that the first word is SOMETEXT you could strip it from the argument list that getopts processes:if [[ 'SOMETEXT' == $1 ]]then    echo Found SOMETEXT at the beginning of the line    shiftfiwhile getopts p: optdo   case $opt in   p) result=$OPTARG;;   esacdoneecho The result is  $result 