Patch-ID: bash32-029
[bash.git] / tests / getopts5.sub
blobc6e388816e34ecf9c3df2a6567682911fb2dedb7
1 #!/local/bin/bash
2 #Time-stamp: <95/06/07 07:40:40 hrue@imf.unit.no>
4 getop () {
6 local OPTIND
7 local OPTERR=1
9 echo getop: OPTERR=$OPTERR
10 while getopts ab arg "$@"; do
11 case $arg in
13 echo a here
16 echo b here
18 :|?|*)
19 echo something else here
21 esac
22 done
23 echo getop: OPTIND=$OPTIND
26 OPTIND=
27 OPTERR=0
29 echo OPTERR=$OPTERR
30 while getopts ab arg; do
31 case $arg in
33 echo a here
36 echo b here
38 :|?|*)
40 echo something else here
42 esac
43 done
45 echo OPTIND=$OPTIND
47 getop "$@" -d -e
49 echo OPTIND=$OPTIND
50 echo OPTERR=$OPTERR