source: vendor/bash/3.1-p17/tests/getopts.tests

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

bash 3.1

File size: 1.1 KB
Line 
1# getopts tests
2# this should fail
3getopts
4echo $?
5getopts opts
6echo $?
7
8# maybe someday we will have a ksh93-like -a argument to set the name
9# used in error messages, but not yet
10getopts -a opts name
11
12${THIS_SH} ./getopts1.sub -a -b bval one two three
13# make sure getopts works when there are more than 9 positional parameters
14${THIS_SH} ./getopts1.sub -a -b bval one two three four five six seven eight nine ten eleven twelve
15${THIS_SH} ./getopts1.sub -a -b
16
17${THIS_SH} ./getopts2.sub -ad -c cval three four five
18
19${THIS_SH} ./getopts3.sub
20
21# make sure that `-b bval' and `-bbval' are equivalent
22${THIS_SH} ./getopts4.sub -a -b bval one two three
23${THIS_SH} ./getopts4.sub -a -bbval one two three
24# this tests `silent' error reporting
25${THIS_SH} ./getopts4.sub -a -b
26${THIS_SH} ./getopts4.sub -a -c
27
28# make sure that `--' can be used to end the list of options
29${THIS_SH} ./getopts4.sub -a -- -b bval one two three
30
31${THIS_SH} ./getopts5.sub -a -c
32
33${THIS_SH} ./getopts6.sub -a
34${THIS_SH} ./getopts6.sub -a -c
35${THIS_SH} ./getopts6.sub -ac
36echo $? # this should be 2
37
38${THIS_SH} ./getopts7.sub -a
Note: See TracBrowser for help on using the repository browser.