]> git.ipfire.org Git - thirdparty/bash.git/blame - tests/getopts2.sub
Bash-4.3 patch 7
[thirdparty/bash.git] / tests / getopts2.sub
CommitLineData
d166f048
JA
1aflag=
2bflag=
3
4while getopts ab:c:de name "$@"
5do
6 case $name in
7 a) aflag=1 ;;
8 b) bflag=1
9 bval=$OPTARG;;
10 c) cflag=1
11 cval=$OPTARG ;;
12 d) dflag=1 ;;
13 e) eflag=1;;
14 ?) echo Usage: $0 [-a] [-b value] [-c value] -[de] args
15 exit 2;;
16 esac
17
18done
19
20[ ! -z "$aflag" ] && echo -a specified
21[ ! -z "$bflag" ] && echo -b $bval specified
22[ ! -z "$cflag" ] && echo -c $cval specified
23[ ! -z "$dflag" ] && echo -d specified
24[ ! -z "$eflag" ] && { echo -n - ; echo e specified; }
25
26exit 0