2017-08-13 06:29:00 +05:30
|
|
|
(
|
|
|
|
|
2017-08-11 05:35:21 +05:30
|
|
|
set -- -q -w e -r -t -y
|
|
|
|
echo "*** no OPTIND, optstring:'w:et' args:$*"
|
|
|
|
var=QWERTY
|
|
|
|
OPTARG=ASDFGH
|
|
|
|
while getopts "w:et" var; do
|
|
|
|
echo "var:'$var' OPTIND:$OPTIND OPTARG:'$OPTARG'"
|
2017-08-11 06:07:48 +05:30
|
|
|
OPTARG=ASDFGH
|
2017-08-11 05:35:21 +05:30
|
|
|
done
|
|
|
|
echo "exited: var:'$var' OPTIND:$OPTIND OPTARG:'$OPTARG'"
|
|
|
|
|
|
|
|
set -- -w 1 -w2 -w -e -e -t -t
|
|
|
|
echo "*** OPTIND=0, optstring:'w:et' args:$*"
|
|
|
|
OPTIND=0
|
|
|
|
while getopts "w:et" var; do
|
|
|
|
echo "var:'$var' OPTIND:$OPTIND OPTARG:'$OPTARG'"
|
2017-08-11 06:07:48 +05:30
|
|
|
OPTARG=ASDFGH
|
2017-08-11 05:35:21 +05:30
|
|
|
done
|
|
|
|
echo "exited: var:'$var' OPTIND:$OPTIND OPTARG:'$OPTARG'"
|
2017-08-13 06:29:00 +05:30
|
|
|
|
|
|
|
) 2>&1 \
|
|
|
|
| sed -e 's/ unrecognized option: / invalid option -- /' \
|
|
|
|
-e 's/ illegal option -- / invalid option -- /' \
|