blob: c6e388816e34ecf9c3df2a6567682911fb2dedb7 [file] [log] [blame]
Jari Aaltod166f041997-06-05 14:59:13 +00001#!/local/bin/bash
2#Time-stamp: <95/06/07 07:40:40 hrue@imf.unit.no>
3
4getop () {
5
6 local OPTIND
7 local OPTERR=1
8
9 echo getop: OPTERR=$OPTERR
10 while getopts ab arg "$@"; do
11 case $arg in
12 a)
13 echo a here
14 ;;
15 b)
16 echo b here
17 ;;
18 :|?|*)
19 echo something else here
20 ;;
21 esac
22 done
23 echo getop: OPTIND=$OPTIND
24}
25
26OPTIND=
27OPTERR=0
28
29echo OPTERR=$OPTERR
30while getopts ab arg; do
31 case $arg in
32 a)
33 echo a here
34 ;;
35 b)
36 echo b here
37 ;;
38 :|?|*)
39
40 echo something else here
41 ;;
42 esac
43done
44
45echo OPTIND=$OPTIND
46
47getop "$@" -d -e
48
49echo OPTIND=$OPTIND
50echo OPTERR=$OPTERR