repo.or.cz
/
bash.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Patch-ID: bash32-029
[bash.git]
/
tests
/
getopts1.sub
blob
df0a342ead51c515c991c30d3f5aaa668719e38b
1
aflag=
2
bflag=
3
4
while getopts ab: name
5
do
6
case $name in
7
a) aflag=1 ;;
8
b) bflag=1
9
bval=$OPTARG;;
10
?) echo Usage: $0 [-a] [-b value] args
11
exit 2;;
12
esac
13
14
done
15
16
if [ ! -z "$aflag" ] ; then echo -a specified ; fi
17
if [ ! -z "$bflag" ] ; then echo -b $bval specified ; fi
18
19
if [ "$OPTIND" -gt 1 ]
20
then
21
shift $(( $OPTIND - 1 ))
22
fi
23
24
echo remaining args: "$*"
25
26
exit 0