projects
/
platform
/
upstream
/
bash.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
Imported from ../bash-2.01.tar.gz.
[platform/upstream/bash.git]
/
tests
/
getopts.sub5
1
#!/local/bin/bash
2
#Time-stamp: <95/06/07 07:40:40 hrue@imf.unit.no>
3
4
getop () {
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
26
OPTIND=
27
OPTERR=0
28
29
echo OPTERR=$OPTERR
30
while 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
43
done
44
45
echo OPTIND=$OPTIND
46
47
getop "$@" -d -e
48
49
echo OPTIND=$OPTIND
50
echo OPTERR=$OPTERR