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