Line | |
---|
1 | aflag=
|
---|
2 | bflag=
|
---|
3 |
|
---|
4 | while getopts :ac name "$@"
|
---|
5 | do
|
---|
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
|
---|
15 | done
|
---|
16 |
|
---|
17 | if [ ! -z "$aflag" ] ; then echo -a specified ; fi
|
---|
18 | if [ ! -z "$cflag" ] ; then echo -c specified ; fi
|
---|
19 |
|
---|
20 | if [ "$OPTIND" -gt 1 ]
|
---|
21 | then
|
---|
22 | shift $(( $OPTIND - 1 ))
|
---|
23 | fi
|
---|
24 |
|
---|
25 | echo remaining args: "$*"
|
---|
26 |
|
---|
27 | exit 0
|
---|
Note:
See
TracBrowser
for help on using the repository browser.