什么官许愿| 区长什么级别| 干什么| 白带发黄什么原因| 头发发黄是什么原因| 出车前检查的目的是什么| 月经来黑色是什么原因| 断裂是什么意思| 两个禾念什么| 肛门长肉球是什么原因| 鸡蛋壳属于什么垃圾| 囊性结构是什么意思| 眼睛干涩模糊用什么眼药水| 9月8号是什么星座| 情人眼里出西施是什么心理效应| 脱肛是什么意思| 纸老虎比喻什么样的人| 中医四诊指的是什么| ict是什么意思| 打嗝挂什么科| 脊柱侧弯拍什么片子| 多多关照是什么意思| 红红的苹果像什么句子| tommy什么牌子| 肺热会引起什么症状| 婴儿胎毛什么时候剃最好| 痢疾是什么病| 念珠菌和霉菌有什么区别| 坐以待毙是什么意思| 才情是什么意思| 肌酐高是什么引起的| 阿里巴巴是干什么的| 胡子发黄是什么原因| 66什么意思| 海绵宝宝是什么生物| 脸上脂溢性皮炎用什么药| 宫寒是什么| 7月4号是什么节日| 黄芪的功效与作用是什么| 小孩趴着睡觉是什么原因| 木字旁的有什么字| 小肚子是什么部位| 大黄是什么药材| 吃什么长胸| 什么牌子好| 蹼是什么意思| 莆田医院是什么意思| 心脏病有什么症状| 焦虑吃什么药| 迪根是什么药| 开水烫伤用什么方法好的最快| 你好后面加什么符号| 荏苒是什么意思| 乐字属于五行属什么| 太阳是什么| 口是心非什么意思| ochirly是什么牌子| 嘴里发咸是什么原因| 低钙血症是什么意思| 捡帽子有什么说法吗| 男士私处瘙痒用什么药| atp是什么意思| 检查包皮挂什么科| 阿尼是什么意思| 涌泉穴在什么位置| 伤到骨头吃什么好得快| 上海市市委书记是什么级别| 满面红光是什么意思| 什么是尿常规检查| 寿眉茶属于什么茶| 六月十五号是什么星座| 梦见笑是什么意思| 打一个喷嚏代表什么| 坎宅是什么意思| 同学过生日送什么礼物好| lime是什么水果| 梦见给别人理发是什么意思| 附身是什么意思| 4月1日什么星座| 师字五行属什么| 四季花是什么花| 以色列是什么人种| 无创低风险是什么意思| 咳嗽一直不好是什么原因怎么治| 怀孕前三个月忌吃什么| 怀二胎初期有什么症状| 狗肉不能和什么食物一起吃| 八月底什么星座| 经血是什么血| 胃气上逆有什么好的办法治疗| 什么的果实| 闭合性骨折是什么意思| 脑子瓦特了什么意思| 什么时候测血压最准确| 高血压一般在什么年龄| 牙痛安又叫什么| 美国为什么帮以色列| pc是什么材料| adivon是什么牌子| castle是什么意思| 火烧火燎是什么意思| 阴谋是什么意思| 肩膀骨头响是什么原因| 康乃馨适合送什么人| 甲床是什么| 脸上发麻是什么原因| 头发油腻是什么原因| 和田玉籽料是什么意思| 哲五行属什么| 小孩肚子疼吃什么药好| 吃什么增加免疫力| 脑花是什么东西| 糖尿病人早餐吃什么最好| 百香果什么时候吃最好| 米线配菜都有什么| 苦瓜不能和什么一起吃| 皮肤敏感是什么意思| 青色是什么颜色的图片| 心跳太快吃什么药| 什么是压缩性骨折| 吃黑芝麻有什么好处| 甘油三酯高吃什么药效果好| ag医学上是什么意思| 脚丫痒是什么原因| 什么补肝| 血压低吃什么补| 有没有什么| 青津果的功效是什么| 佛珠断了有什么预兆| 激光脱毛对人体有没有什么危害| 大连靠近什么海| 嗓子疼吃什么食物好| 酸角是什么| 心有不甘是什么意思| mdt是什么| 额头长痘是因为什么| 什么是消毒| 梦见涨水是什么兆头| 什么叫平仓| 胸闷气短是什么原因引起的| 骨折有什么症状| 双子座是什么时候| 柠檬片泡水喝有什么功效和作用| 囊性结构是什么意思| 血池是什么意思| 战战兢兢的意思是什么| 丑未相冲的结果是什么| 山楂可以和什么一起泡水喝| pda是什么| 附子理中丸治什么病| 什么容易误诊为水痘| 沈阳有什么好玩的地方| 柯字五行属什么| 六个点是什么意思| 什么是包容| reed是什么意思| 上海有什么好玩的地方适合小孩子| 什么入胜| 坤造是什么意思| 小腿肌肉痛什么原因| paba是什么药| 岩茶是什么茶类| 感觉是什么意思| 青梅是什么水果| 吉兰巴雷综合征是什么病| 豆汁是什么味道| 重逢是什么意思| 咖喱是什么材料做的| 1983年五行属什么| 什么人不能吃洋葱| 为什么总是想睡觉| 梦见墓碑是什么意思| 你在纠结什么| 四肢抽搐口吐白沫是什么病| 下作是什么意思| 小虾米吃什么| 属猪的护身佛是什么佛| 肩膀疼痛挂什么科| 女性膀胱炎是什么症状| 332是什么意思| 梦魇是什么原因造成的| 梦见被蛇追着咬是什么意思| 脂肪有什么作用| 身上长白点是什么原因| 三月十二是什么星座| 吃什么健脾胃除湿气| 清远有什么好玩的| 阿鼻地狱是什么意思| 肝虚吃什么中成药| 皮肤有白点是什么原因| 2月8日什么星座| 你好后面加什么符号| 不知餍足什么意思| 补办户口本需要什么材料| prada是什么档次| 肠化生是什么症状| 脚背浮肿是什么原因引起的| 梦见捡钱了是什么预兆| 左耳烫代表什么预兆| 什么是有机食品| 歧路亡羊告诉我们什么道理| 葡萄球菌是什么| 银子有什么功效与作用| 艳羡是什么意思| 集合是什么| 残局是什么意思| 摆摊卖什么好| 牙龈上火是什么原因引起的| 为什么微信运动总是显示步数为0| 小确幸什么意思| joola是什么牌子| 甲状腺腺体回声欠均匀是什么意思| 喆读什么| 扑朔迷离是什么意思| 不以规矩下一句是什么| 骸骨是什么意思| 下巴肿大是什么原因| 黄片是什么| 什么家庭养出自私冷漠| 下体瘙痒用什么药| 过敏性鼻炎吃什么| 人为什么要吃饭| 什么然有序| 小儿惊痫是什么症状| 继发性高血压什么意思| 剧情是什么意思| 阴虚有什么症状| 稷是什么意思| 阁字五行属什么| 淋巴结是什么引起的| 床头上面挂什么画好| 破瓦法是什么| 10月24日什么星座| 为什么会一直流鼻涕| 泰迪哼哼唧唧表示什么| 幡是什么意思| 谷丙转氨酶高是什么原因| 全身冰凉是什么原因| 什么狗最聪明| 屁股长痘是什么原因| 鼻咽炎有什么症状| 一个山一个空念什么| 脚软没力气是什么原因引起的| 放疗起什么作用| 杏仁有什么功效| 白天不懂夜的黑什么意思| 桔色搭配什么颜色好看| 医生助理是做什么的| 儿童超敏c反应蛋白高说明什么| 滑脉是什么意思| 冲锋衣是什么意思| 湿疹吃什么药好| 大三阳是什么| 神经内科看什么病| 什么是数据标注| 惊讶表情是什么意思| 肾阳虚吃什么食物| 八月十六号是什么星座| 眼睛肿疼是什么原因引起的| 金银花泡水喝有什么好处| 吉利丁片是什么东西| 百合有什么功效和作用| 运动后想吐是什么原因| 立夏什么时候| 百度
The Open Group Base Specifications Issue 7, 2018 edition
IEEE Std 1003.1-2017 (Revision of IEEE Std 1003.1-2008)
Copyright © 2001-2018 IEEE and The Open Group
A newer edition of this document exists here

12. Utility Conventions

12.1 Utility Argument Syntax

This section describes the argument syntax of the standard utilities and introduces terminology used throughout POSIX.1-2017 for describing the arguments processed by the utilities.

Within POSIX.1-2017, a special notation is used for describing the syntax of a utility's arguments. Unless otherwise noted, all utility descriptions use this notation, which is illustrated by this example (see XCU Simple Commands):

utility_name[-a][-b][-c option_argument]
    [-d|-e][-f[option_argument]][operand...]

The notation used for the SYNOPSIS sections imposes requirements on the implementors of the standard utilities and provides a simple reference for the application developer or system user.

  1. The utility in the example is named utility_name. It is followed by options, option-arguments, and operands. The arguments that consist of <hyphen-minus> characters and single letters or digits, such as 'a', are known as "options" (or, historically, "flags"). Certain options are followed by an "option-argument", as shown with [ -c option_argument]. The arguments following the last options and option-arguments are named "operands".

  2. Option-arguments are shown separated from their options by <blank> characters, except when the option-argument is enclosed in the '[' and ']' notation to indicate that it is optional. This reflects the situation in which an optional option-argument (if present) is included within the same argument string as the option; for a mandatory option-argument, it is the next argument. The Utility Syntax Guidelines in Utility Syntax Guidelines require that the option be a separate argument from its option-argument and that option-arguments not be optional, but there are some exceptions in POSIX.1-2017 to ensure continued operation of historical applications:

    1. If the SYNOPSIS of a standard utility shows an option with a mandatory option-argument (as with [ -c option_argument] in the example), a conforming application shall use separate arguments for that option and its option-argument. However, a conforming implementation shall also permit applications to specify the option and option-argument in the same argument string without intervening <blank> characters.

    2. If the SYNOPSIS shows an optional option-argument (as with [ -f[ option_argument]] in the example), a conforming application shall place any option-argument for that option directly adjacent to the option in the same argument string, without intervening <blank> characters. If the utility receives an argument containing only the option, it shall behave as specified in its description for an omitted option-argument; it shall not treat the next argument (if any) as the option-argument for that option.

  3. Options are usually listed in alphabetical order unless this would make the utility description more confusing. There are no implied relationships between the options based upon the order in which they appear, unless otherwise stated in the OPTIONS section, or unless the exception in Guideline 11 of Utility Syntax Guidelines applies. If an option that does not have option-arguments is repeated, the results are undefined, unless otherwise stated.

  4. Frequently, names of parameters that require substitution by actual values are shown with embedded <underscore> characters. Alternatively, parameters are shown as follows:

    <parameter name>
    
    

    The angle brackets are used for the symbolic grouping of a phrase representing a single parameter and conforming applications shall not include them in data submitted to the utility.

  5. When a utility has only a few permissible options, they are sometimes shown individually, as in the example. Utilities with many flags generally show all of the individual flags (that do not take option-arguments) grouped, as in:

    utility_name [-abcDxyz][-p arg][operand]
    

    Utilities with very complex arguments may be shown as follows:

    utility_name [options][operands]
    
  6. Unless otherwise specified, whenever an operand or option-argument is, or contains, a numeric value:

    This does not mean that all numbers within the allowable range are necessarily semantically correct. A standard utility that accepts an option-argument or operand that is to be interpreted as a number, and for which a range of values smaller than that shown above is permitted by the POSIX.1-2017, describes that smaller range along with the description of the option-argument or operand. If an error is generated, the utility's diagnostic message shall indicate that the value is out of the supported range, not that it is syntactically incorrect.

  7. Arguments or option-arguments enclosed in the '[' and ']' notation are optional and can be omitted. Conforming applications shall not include the '[' and ']' symbols in data submitted to the utility.

  8. Arguments separated by the '|' ( <vertical-line>) bar notation are mutually-exclusive. Conforming applications shall not include the '|' symbol in data submitted to the utility. Alternatively, mutually-exclusive options and operands may be listed with multiple synopsis lines.

    For example:

    utility_name -d[-a][-c option_argument][operand...]
    utility_name[-a][-b][operand...]
    

    When multiple synopsis lines are given for a utility, it is an indication that the utility has mutually-exclusive arguments. These mutually-exclusive arguments alter the functionality of the utility so that only certain other arguments are valid in combination with one of the mutually-exclusive arguments. Only one of the mutually-exclusive arguments is allowed for invocation of the utility. Unless otherwise stated in an accompanying OPTIONS section, the relationships between arguments depicted in the SYNOPSIS sections are mandatory requirements placed on conforming applications. The use of conflicting mutually-exclusive arguments produces undefined results, unless a utility description specifies otherwise. When an option is shown without the '[' and ']' brackets, it means that option is required for that version of the SYNOPSIS. However, it is not required to be the first argument, as shown in the example above, unless otherwise stated.

  9. Ellipses ( "..." ) are used to denote that one or more occurrences of an operand are allowed. When an option or an operand followed by ellipses is enclosed in brackets, zero or more options or operands can be specified. The form:

    utility_name [-g option_argument]...[operand...]
    

    indicates that multiple occurrences of the option and its option-argument preceding the ellipses are valid, with semantics as indicated in the OPTIONS section of the utility. (See also Guideline 11 in Utility Syntax Guidelines .)

    The form:

    utility_name -f option_argument [-f option_argument]... [operand...]
    

    indicates that the -f option is required to appear at least once and may appear multiple times.

  10. When the synopsis line is too long to be printed on a single line in the Shell and Utilities volume of POSIX.1-2017, the indented lines following the initial line are continuation lines. An actual use of the command would appear on a single logical line.

12.2 Utility Syntax Guidelines

The following guidelines are established for the naming of utilities and for the specification of options, option-arguments, and operands. The getopt() function in the System Interfaces volume of POSIX.1-2017 assists utilities in handling options and operands that conform to these guidelines.

Operands and option-arguments can contain characters not specified in the portable character set.

The guidelines are intended to provide guidance to the authors of future utilities, such as those written specific to a local system or that are components of a larger application. Some of the standard utilities do not conform to all of these guidelines; in those cases, the OPTIONS sections describe the deviations.

Guideline 1:
Utility names should be between two and nine characters, inclusive.
Guideline 2:
Utility names should include lowercase letters (the lower character classification) and digits only from the portable character set.
Guideline 3:
Each option name should be a single alphanumeric character (the alnum character classification) from the portable character set. The -W (capital-W) option shall be reserved for vendor options.

Multi-digit options should not be allowed.

Guideline 4:
All options should be preceded by the '-' delimiter character.
Guideline 5:
One or more options without option-arguments, followed by at most one option that takes an option-argument, should be accepted when grouped behind one '-' delimiter.
Guideline 6:
Each option and option-argument should be a separate argument, except as noted in Utility Argument Syntax, item (2).
Guideline 7:
Option-arguments should not be optional.
Guideline 8:
When multiple option-arguments are specified to follow a single option, they should be presented as a single argument, using <comma> characters within that argument or <blank> characters within that argument to separate them.
Guideline 9:
All options should precede operands on the command line.
Guideline 10:
The first -- argument that is not an option-argument should be accepted as a delimiter indicating the end of options. Any following arguments should be treated as operands, even if they begin with the '-' character.
Guideline 11:
The order of different options relative to one another should not matter, unless the options are documented as mutually-exclusive and such an option is documented to override any incompatible options preceding it. If an option that has option-arguments is repeated, the option and option-argument combinations should be interpreted in the order specified on the command line.
Guideline 12:
The order of operands may matter and position-related interpretations should be determined on a utility-specific basis.
Guideline 13:
For utilities that use operands to represent files to be opened for either reading or writing, the '-' operand should be used to mean only standard input (or standard output when it is clear from context that an output file is being specified) or a file named -.
Guideline 14:
If an argument can be identified according to Guidelines 3 through 10 as an option, or as a group of options without option-arguments behind one '-' delimiter, then it should be treated as such.

The utilities in the Shell and Utilities volume of POSIX.1-2017 that claim conformance to these guidelines shall conform completely to these guidelines as if these guidelines contained the term "shall" instead of "should". On some implementations, the utilities accept usage in violation of these guidelines for backwards-compatibility as well as accepting the required form.

Where a utility described in the Shell and Utilities volume of POSIX.1-2017 as conforming to these guidelines is required to accept, or not to accept, the operand '-' to mean standard input or output, this usage is explained in the OPERANDS section. Otherwise, if such a utility uses operands to represent files, it is implementation-defined whether the operand '-' stands for standard input (or standard output), or for a file named -.

It is recommended that all future utilities and applications use these guidelines to enhance user portability. The fact that some historical utilities could not be changed (to avoid breaking existing applications) should not deter this future goal.

 

return to top of page

UNIX ® is a registered Trademark of The Open Group.
POSIX ™ is a Trademark of The IEEE.
Copyright © 2001-2018 IEEE and The Open Group, All Rights Reserved
[ Main Index | XBD | XSH | XCU | XRAT ]

荨麻疹用什么药膏 出痧是什么意思 醛固酮高有什么危害 展望未来什么意思 se是什么国家
大象的耳朵有什么作用 什么是什么意思 吃知柏地黄丸有什么副作用 乐子是什么意思 荷字五行属什么
胃炎吃什么水果 俄罗斯信仰什么教 SS是什么 半月板退变是什么意思 不着相是什么意思
经理是什么级别 卡号是什么 高尿酸血症是什么病 乳房钙化灶是什么意思 属兔的婚配什么属相好
什么牌子的助听器好hcv9jop7ns4r.cn 为什么晚上不能倒垃圾hcv9jop6ns8r.cn 尿毒症是什么症状hcv8jop0ns3r.cn 赤脚走路有什么好处creativexi.com 5个月宝宝可以吃什么水果jiuxinfghf.com
东南方是什么生肖hcv8jop2ns4r.cn 儿童查微量元素挂什么科zhiyanzhang.com 亚玛病是什么病hcv8jop8ns8r.cn 梦见老人去世预示什么hcv7jop6ns9r.cn 脚浮肿吃什么药hcv9jop3ns4r.cn
全国政协副主席是什么级别hcv8jop8ns5r.cn 水头是什么意思clwhiglsz.com 宫颈癌前期有什么症状hcv8jop3ns8r.cn 睾丸疼痛挂什么科hcv9jop2ns8r.cn 1.4是什么星座jasonfriends.com
老放屁吃什么药好hcv7jop6ns5r.cn 脑委缩有什么症状hcv9jop4ns4r.cn 什么路不能走hcv8jop6ns5r.cn 感冒后咳嗽吃什么药hcv9jop2ns7r.cn 投诉护士找什么部门hcv7jop9ns5r.cn
百度