]> git.ipfire.org Git - thirdparty/bash.git/blame - tests/getopts6.sub
Bash-4.3 patch 7
[thirdparty/bash.git] / tests / getopts6.sub
CommitLineData
d166f048
JA
1aflag=
2bflag=
3
4while getopts :ac name "$@"
5do
6 case $name in
7 a) aflag=1 ;;
8 c) cflag=1 ;;
9 ?) exit 2;;
10 esac
11
12 # this came in in a bug report -- it's really a usage error
13 # but it shouldn't cause the shell to crash
14 shift
15done
16
17if [ ! -z "$aflag" ] ; then echo -a specified ; fi
18if [ ! -z "$cflag" ] ; then echo -c specified ; fi
19
20if [ "$OPTIND" -gt 1 ]
21then
22 shift $(( $OPTIND - 1 ))
23fi
24
25echo remaining args: "$*"
26
27exit 0