]> git.ipfire.org Git - thirdparty/bash.git/blame - tests/getopts1.sub
bash-4.3-rc2 overlay
[thirdparty/bash.git] / tests / getopts1.sub
CommitLineData
726f6388
JA
1aflag=
2bflag=
3
4while getopts ab: name
5do
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
14done
15
16if [ ! -z "$aflag" ] ; then echo -a specified ; fi
17if [ ! -z "$bflag" ] ; then echo -b $bval specified ; fi
18
19if [ "$OPTIND" -gt 1 ]
20then
21 shift $(( $OPTIND - 1 ))
22fi
23
24echo remaining args: "$*"
25
26exit 0