- 论坛徽章:
- 1
|
原帖由 boss_juzi 于 2005-12-23 20:41 发表
为什么你的while getopts “:”在参数前有个:呢?只有需要时间参数的时候才用:啊!
应该x:才对啊。。。并且,你的while这行的最后,没有;号吧
getopts can report errors in two ways. If the first character
of optstring is a colon, silent error reporting is used. In
normal operation diagnostic messages are printed when invalid
options or missing option arguments are encountered. If the
variable OPTERR is set to 0, no error messages will be dis-
played, even if the first character of optstring is not a colon.
If an invalid option is seen, getopts places ? into name and, if
not silent, prints an error message and unsets OPTARG. If
getopts is silent, the option character found is placed in
OPTARG and no diagnostic message is printed.
If a required argument is not found, and getopts is not silent,
a question mark (?) is placed in name, OPTARG is unset, and a
diagnostic message is printed. If getopts is silent, then a
colon ( is placed in name and OPTARG is set to the option
character found. |
|