>
> Try
>
> echo "${@:$OPTIND}"
>
> before the if to see if it has the value you expect. I'm guessing you may
> need to adjust the offset value.
>
Hi Dennis, I can see what you mean. "${@:$OPTIND}" is giving all argumunts from
$OPTIND onwards. So now I am using
("v")
echo "\${@:\$OPTIND}: ${@:$OPTIND}"
if [[ ${@:$OPTIND:1} =~ ^[0-9]+$ ]]; then
vb=${@:$OPTIND:1}
OPTIND=$((OPTIND+1))
else
vb=1
fi
;;
Would the change be satisfactory?