source: vendor/bash/3.1-p17/tests/getopts2.sub

Last change on this file was 3228, checked in by bird, 18 years ago

bash 3.1

File size: 480 bytes
Line 
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
Note: See TracBrowser for help on using the repository browser.