1 # This program is free software: you can redistribute it and/or modify
2 # it under the terms of the GNU General Public License as published by
3 # the Free Software Foundation, either version 3 of the License, or
4 # (at your option) any later version.
6 # This program is distributed in the hope that it will be useful,
7 # but WITHOUT ANY WARRANTY; without even the implied warranty of
8 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 # GNU General Public License for more details.
11 # You should have received a copy of the GNU General Public License
12 # along with this program. If not, see <http://www.gnu.org/licenses/>.
21 # maybe someday we will have a ksh93-like -a argument to set the name
22 # used in error messages, but not yet
25 ${THIS_SH} ./getopts1.sub -a -b bval one two three
26 # make sure getopts works when there are more than 9 positional parameters
27 ${THIS_SH} ./getopts1.sub -a -b bval one two three four five six seven eight nine ten eleven twelve
28 ${THIS_SH} ./getopts1.sub -a -b
30 ${THIS_SH} ./getopts2.sub -ad -c cval three four five
32 ${THIS_SH} ./getopts3.sub
34 # make sure that `-b bval' and `-bbval' are equivalent
35 ${THIS_SH} ./getopts4.sub -a -b bval one two three
36 ${THIS_SH} ./getopts4.sub -a -bbval one two three
37 # this tests `silent' error reporting
38 ${THIS_SH} ./getopts4.sub -a -b
39 ${THIS_SH} ./getopts4.sub -a -c
41 # make sure that `--' can be used to end the list of options
42 ${THIS_SH} ./getopts4.sub -a -- -b bval one two three
44 ${THIS_SH} ./getopts5.sub -a -c
46 ${THIS_SH} ./getopts6.sub -a
47 ${THIS_SH} ./getopts6.sub -a -c
48 ${THIS_SH} ./getopts6.sub -ac
49 echo $? # this should be 2
51 ${THIS_SH} ./getopts7.sub -a
53 ${THIS_SH} ./getopts8.sub
54 ${THIS_SH} ./getopts9.sub
56 ${THIS_SH} ./getopts10.sub