aboutsummaryrefslogtreecommitdiff
path: root/shell/ash_test/ash-getopts/getopt_optarg.tests
blob: b346284f0e9888c671bb1e2a535079cc3a7d2b3d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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'"
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'"
done
echo "exited: var:'$var' OPTIND:$OPTIND OPTARG:'$OPTARG'"