1 / 16
文档名称:

linux getopts 学习笔记(Linux getopts 学习笔记).doc

格式:doc   大小:24KB   页数:16页
下载后只包含 1 个 DOC 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

分享

预览

linux getopts 学习笔记(Linux getopts 学习笔记).doc

上传人:rjmy2261 2017/11/22 文件大小:24 KB

下载得到文件列表

linux getopts 学习笔记(Linux getopts 学习笔记).doc

文档介绍

文档介绍:linux getopts 学****笔记(Linux getopts 学****笔记)
Options for getting UNIX types:
One of the advantages of UNIX is that the standard mand has the mand line format in execution:
Command -options parameters
If the Shell program is used, the Bourne Shell provides a statement to obtain and mand line options, that is, the getopts statement. The format of the statement is:
Getopts option_string variable
Among them, option_string contains an effective single character option. If the mand finds a hyphen in mand line, it pare the characters behind the hyphen with the option_string. If there is a match, the value of the variable variable is set to this option. If there is no matching, is variable set as?. When getopts finds that there is no character behind the hyphen, a nonzero state value is returned. In Shell programs, a loop can be established by using the return value of getopts.
Sometimes a value is added to the option, and the mand also supports this functionality. Then you need to add a colon to the letter in the option_string. When the mand finds the colon, the value is read from mand line. If this value exists, it will be present in a special variable OPTARG. If this value does not exist, the mand stores a question mark in the OPTARG and displays a message on the
standard error output.
The optstring option string matches one by one
Varname options for essful matching each time
The Arg parameter list, when not written, takes mand line parameter list
$OPTIND special variable, option index, will increase by degrees, with an initial value of 1
$OPTARG special variable, option argument, has different values in different situations
Rule 1: when optstring with ":" at the beginning, getopts will distinguish between invalid option errors and miss option argument errors.
When invalid option, Varname will be set? $OPTARG is the option of the problem;
When Miss option argument, Varname is set as: $OPTARG is the option of the problem.
If optstring does not, "start", "inva

最近更新

2024年小数的意义教学设计合集15篇 82页

图式理论视阈下李清照词英译研究的开题报告 2页

图像的素描水墨风格化研究的开题报告 2页

2024年小孩表扬信 14页

2024年小学音乐老师教学计划(5篇) 15页

国税税务专项资金绩效审计问题分析的开题报告.. 2页

2024年小学阶段语文学习方法指导建议(通用12.. 31页

2024年小学运动会作文300字通用(4篇) 4页

2024年小学贫困生补助申请书(7篇) 8页

团体游戏辅导对4-6岁被拒绝幼儿同伴交往能力的.. 2页

四通道成像开窗系统的设计与实现的开题报告 2页

四川盐业供应链分析及其应急响应研究的开题报.. 2页

工作中犯错误检讨书 31页

嗜热真菌热稳定纤维素酶的分子改造及特性研究.. 2页

商务英语邮件中的礼貌用语分析中期报告 2页

商业银行零售信贷产品定价研究的开题报告 2页

2024年小学英语老师的教学工作计划范文 11页

类风湿和狼疮患者的日常注意事项 49页

2024年小学英语教师教学工作计划15篇 49页

2023年消防救援站党支部工作总结 4页

慢性胃炎中医症候评分表格模板2 3页

教师心得体会师德感悟篇范文2023年 9页

学校食堂6s管理内容和标准四篇 51页

夹江陶瓷产业发展历程和基本概况 5页

超声科质量控制评分表(共1页) 1页

高速铁路桥梁缺陷整治方案 56页

尊师开示 7页

十五种解经讲道法(1) 55页

张宏宝尊师谈养生修炼的利与弊 10页