getopt
-
Finally , the actual call to the getopt routine will look like this
最后,对getopt例程的实际调用如下所示
-
The getopt () function requires these parameters
getopt()函数需要三个参数
-
The getopt command : See IBM 's commands reference for more information about this command .
getopt命令:关于这个命令的更多信息请参考IBM的命令参考。
-
There are a few things you need to do so that you can use the getopt library .
要想使用getopt库,需要做几件事。
-
The built-in shell command getopt does just that job .
内置的shell命令getopt可以完成这个任务。
-
If you 're not familiar with getopt (), this may require some explanation .
如果您不熟悉getopt(),则需要解释一下。
-
Accumulation stops when the special getopt option , & , is encountered .
当遇到特殊getopt选项&时,选项收集过程停止。
-
However , for more complex argument parsing , you may want to check out the getopt () function .
然而,对于更复杂的参数解析,您可能希望查看getopt()函数。
-
You also need to tell the getopt () function that each of these options should be followed by a value .
还需要告诉getopt()函数每个选项后面应该有一个值。
-
Invoke the getopt . getopt () function and pass it the required parameters .
调用getopt.getopt()函数并把必需的参数传递给它。
-
Import the getopt library module .
导入getopt库模块。
-
The getopt UNIX utility scans the positional parameters for the named arguments you specify .
UNIX实用程序getopt扫描位置参数以获得您指定的命名参数。
-
Otherwise , getopt returns a string of the options ending with the special string , & .
否则,getopt返回一个以特殊字符串&结尾的选项字符串。
-
Read the man page for getopt (), man3 getopt () .
请参阅getopt的手册页man3getopt。
-
Remember that the getopt library routine is general in nature , and not every command line option is expected to have an associated value .
请记住,getopt库例程本质上是通用的,而且并非每个命令行选项都有相关联的值。
-
If getopt succeeds , $ args has a list of options .
如果getopt成功,则$args具有一个选项列表。
-
The twitter_do.pl script uses Getopt : : Long to get command-line arguments , as summarized in the usage () function .
twitterdo.pl脚本使用Getopt::Long获得命令行参数,如usage()函数描述的一样。
-
The return from getopt () is-1 when there are no more options .
当没有更多的选项时,getopt()返回-1。
-
Command-line switches with Getopt : : Std
使用Getopt::Std的命令行开关
-
The getopt () routine processes the arguments ( you must pass it argc and argv ) according to a string of accepted option characters .
getopt()例程根据接受的选项字符的字符串来处理参数(必须传递给它argc和argv)。
-
In this example , you want the getopt function to check for the existence of any of the option letters in that string , and each should have a value .
在这个示例中,希望让getopt函数检查命令行中是否有任何选项字母,而且每个选项应该有一个值。
-
One such library is the getopt library , which is based on work that was done long ago for the C programming language to enable programs written in C to easily process command line parameters .
这种库之一是getopt库,它基于很久以前让C语言程序轻松地处理命令行参数的技术。
-
Type'perldoc Getopt : : Std'or'perldoc Getopt : : Long'at your prompt to retrieve the documentation for these modules , which make parsing command-line arguments easy .
在提示符下输入‘perldocGetopt::Std’或‘perldocGetopt::Long’检索这些模块的文档,它使得解析命令行参数更容易。
-
If getopt fails , which occurs when it doesn 't recognize an option , it prints an error message , and the script exits with a usage message .
如果getopt失败,例如在它无法识别某个选项的时候,则它会打印错误消息,并且该脚本将退出并显示用法信息。
-
This is a worthwhile project because better-looking charts will always translate into impressed customers , whereas improving the upload process by using a better Getopt module will not impress them .
这是一个非常有意义的项目,因为外观漂亮的图表总是能够吸引客户,反过来,使用更好的Getopt模块改进上传过程并不会使客户留下深刻印象。
-
A collection of individual flags , plus a small collection of values to set , is a wonderful match for getopt (), but first we need to think about what the flags would be , and where we 'd store them .
一个由各个标记组成的集合加上一个由要设置的值组成的小集合非常适合getopt(),但是首先要考虑使用哪些标记,以及将它们保持在哪里。