📄 utildes.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><!-- Copyright 1997 The Open Group, All Rights Reserved --><title>Utility Description Defaults</title></head><body bgcolor=white><center><font size=2>The Single UNIX ® Specification, Version 2<br>Copyright © 1997 The Open Group</font></center><hr size=2 noshade><center><h3>Utility Description Defaults</h3></center><xref type="2" name="utildes"></xref>This section describes all of the subsections used within the utilitydescriptions, including:<ul><p><li>intended usage of the section<p><li>global defaults that affect all the standard utilities<p><li>the meanings of notations used in the standardthat are specific to individual utility sections.<p></ul><p>Integer variables and constants, including the values of operands and option-arguments, used by the utilities listed in this specification shallbe implemented as equivalent to the ISO C standard <B>signed long</B> data type. Conversion between types shall be as described in the ISO C standard. The evaluation of arithmetic expressions shall be equivalent to that described in Section 6.3 of the ISO C standard.<dl compact><dt><B>SYNOPSIS</B><dd>The SYNOPSISsection summarises the syntax of the calling sequencefor the utility, including options, option-arguments and operands.Standards for utility naming are described in <B>XBD</B> specification, <a href="../xbd/utilconv.html#usg"><B>Utility Syntax Guidelines</B> </a> ;for describing the utility's arguments in <B>XBD</B> specification, <a href="../xbd/utilconv.html"><B>Utility Argument Syntax</B> </a> .<dt><B>DESCRIPTION</B><dd>The DESCRIPTIONsection describes the actions of the utility.If the utility has a very complex set of subcommandsor its own procedural language, an EXTENDED DESCRIPTIONsection is also provided.Most explanations of optional functionality are omitted here, as they areusually explained in the OPTIONS section.Some utilities in this specification are described in termsof functionality equivalent to the <B>XSH</B> specification.When specific functions are cited, the underlying operating systemprovides equivalent functionality and all side effectsassociated with successful execution of the function.The treatment of errors and intermediate resultsfrom the individual functions citedare generally not specified by this specification.See the utility's EXIT STATUS and CONSEQUENCES OF ERRORSsections for all actions associated witherrors encountered by the utility.<dt><B>OPTIONS</B><dd>The OPTIONS section describes the utility options and option-arguments,and how they modify the actions of the utility.Standard utilities that have optionseither fully comply with the <B>XBD</B> specification, <a href="../xbd/utilconv.html#usg"><B>Utility Syntax Guidelines</B> </a> or describe all deviations.Apparent disagreements between functionality descriptionsin the OPTIONS and DESCRIPTION (or EXTENDED DESCRIPTION)sections are always resolved in favour of the OPTIONS section.Each OPTIONS section that uses the phrase "The ... utilitysupports the Utility Syntax Guidelines ..." refersonly to the use of the utility as specified by this specification;implementation extensions should also conform to the guidelines, butmay allow exceptions for historical practice.Unless otherwise stated in the utility description,when given an option unrecognised by the implementation, orwhen a required option-argument is not provided,standard utilities will issue a diagnostic message to standarderror and exit with a non-zero exit status.All utilities in this specification are capable of processing argumentsusing 8-bit transparency.<B>Default Behaviour:</B>When this section is listed as "None",it means that the implementation need not support any options.Standard utilities that do not accept options,but that do accept operands, will recognise --as a first argument to be discarded.The requirement for recognising --is because portable applications need a way to shield theiroperands from any arbitrary options that the implementationmay provide as an extension.For example, if the standard utility<i>foo</i>is listed as taking no options, and the application neededto give it a pathname with a leading hyphen, it could safelydo it as:<pre><code>foo -- -myfile</code></pre>and avoid any problems with <B>-m</B> used as an extension.<dt><B>OPERANDS</B><dd>The OPERANDS section describes the utility operands,and how they affect the actions of the utility.Apparent disagreements between functionality descriptions in theOPERANDS and DESCRIPTION (or EXTENDED DESCRIPTION)sections are always resolved in favour of the OPERANDS section.If an operand naming a file can be specified as "-",which means to use the standard input instead of a named file,this is explicitly stated in this section.Unless otherwise stated, the use of multiple instances of "-"to mean standard input in a single command produces unspecified results.Unless otherwise stated, the standard utilities that acceptoperands will process those operands in theorder specified in the command line.<B>Default Behaviour:</B>When this section is listed as "None",it means that the implementation need not support any operands.<dt><B>STDIN</B><dd>The STDIN section describes the standard input of the utility.This section is frequently merely a reference tothe following section, as many utilities treat standard inputand input files in the same manner.Unless otherwise stated, all restrictions described in theINPUT FILES section apply to this section as well.Use of a terminal for standard input can causeany of the standard utilities that read standard inputto stop when used in the background.For this reason, applications should not use interactive features inscripts to be placed in the background.The specified standard input format of the standard utilitiesdoes not depend on the existence or value of the environmentvariables defined in this specification, except as provided by this specification.<B>Default Behaviour:</B>When this section is listed as "Not used," it meansthat the standard input will not be read when the utility is used asdescribed by this specification.<dt><B>INPUT FILES</B><dd>The INPUT FILES section describes the files, other than thestandard input, used as input by the utility.It includes files named as operands and option-argumentsas well as other files that are referred to, such asstartup and initialisation files, databases, and so on.Commonly-used files are generally described in one place andcross-referenced by other utilities.All utilities in this specification are capable of processing input filesusing 8-bit transparency.When a standard utility reads a seekable input file and terminateswithout an error before it reaches end-of-file,the utility will ensure that the file offset in the open file descriptionis properly positioned just past the last byteprocessed by the utility.For files that are not seekable,the state of the file offsetin the open file description for that file is unspecified.A portable application cannot assume thatthe following three commands are equivalent:<pre><code>tail -n +2 file(sed -n 1q; cat) < filecat file | (sed -n 1q; cat)</code></pre>The second command is equivalent to thefirst only when the file is seekable.The third command leavesthe file offset in the open file descriptionin an unspecified state.Other utilities, such as<i><a href="head.html">head</a></i>,<i><a href="read.html">read</a></i>and<i><a href="sh.html">sh</a></i>,have similar properties.Some of the standard utilities, such as filters,process input files a line or a block at a timeand have no restrictions on the maximum input file size.Some utilities may have size limitations that are notas obvious as file space or memory limitations.Such limitations should reflect resource limitations of some sort, notarbitrary limits set by implementors.Implementations will document those utilities thatare limited by constraints other than file system space,available memory and other limits specifically cited bythis specification, and identify what the constraint is andindicate a way of estimating when the constraint would be reached.Similarly, some utilities descend the directory tree (recursively).Implementations will also document any limits that they may have indescending the directory tree that are beyond limits cited by this specification.When an input file is described as a<i>text file ,</i>the utility produces undefined results if given inputthat is not from a text file, unless otherwise stated.Some utilities (for example,<i><a href="make.html">make</a></i>,<i><a href="read.html">read</a></i>,<i><a href="sh.html">sh</a></i>)allow for continued input lines using an escaped<newline>convention; unless otherwise stated,the utility need not be able to accumulate more than{LINE_MAX}bytes from a set of multiple, continued input lines.Thus, for a portable applicationthe total of all the continued lines in a set cannot exceed{LINE_MAX}.If a utility using the escaped<newline>convention detects an end-of-file conditionimmediately after an escaped<newline>,the results are unspecified.Record formats are described in a notationsimilar to that used by the C-language function,<i><a href="../xsh/printf.html">printf()</a></i>.See <B>XBD</B> specification, <a href="../xbd/notation.html"><B>File Format Notation</B> </a> for a description of this notation.The format description is intended to be sufficientlyrigorous to allow other applications to generate these input files.However, since<blank>characters can legitimately be included in some of the fields describedby the standard utilities, particularly in locales other thanthe POSIX locale, this intent is not always realised.<B>Default Behaviour:</B>When this section is listed as "None",it means that no input filesare required to be supplied whenthe utility is used asdescribed by this specification.<dt><B>ENVIRONMENT VARIABLES</B><dd>The ENVIRONMENT VARIABLES section lists what variablesaffect the utility's execution.The entire manner in which environment variables describedin this specification affect the behaviour of each utility isdescribed in the ENVIRONMENT VARIABLES section for thatutility, in conjunction with the global effects of the<i>LANG ,</i><i>LC_ALL</i>and<i>NLSPATH</i>environment variables described in <B>XBD</B> specification, <a href="../xbd/envvar.html"><B>Environment Variables</B> </a> .The existence or value of environment variables described in thisdocument will not otherwise affect the specified behaviourof the standard utilities.Any effects of the existence or value of environmentvariables not described by this specification upon the standardutilities are unspecified.For those standard utilities that use environment variablesas a means for selecting a utility to execute (such as<i>CC</i>in<i><a href="make.html">make</a></i>),the string provided to the utility is subjected tothe path search described for<i>PATH</i>in the <B>XBD</B> specification, <a href="../xbd/envvar.html"><B>Environment Variables</B> </a> .All utilities in this specification are capable of processing environment variablenames and values using 8-bit transparency.<B>Default Behaviour:</B>When this section is listed as "None", it meansthat the behaviour of the utility is not directly affected byenvironment variables described by this specificationwhen the utility is used as described by this specification.<dt><B>ASYNCHRONOUS EVENTS</B><dd>The ASYNCHRONOUS EVENTS section lists how the utility reacts to suchevents as signals and what signals are caught.<B>Default Behaviour:</B>When this section is listed as "Default",or it refers to "the standard action for all other signals; seeUtility Description Defaults"it means that the action takenas a result of the signal is one of the following:<ol><li>The action is that inherited from the parentaccording to the rules of inheritance of signal actions defined in the <B>XSH</B> specification.<li>When no action has been taken to change the default, thedefault action is that specified by the <B>XSH</B> specification.<li>The result of the utility's executionis as if default actions had been taken.</ol>A utilityis permitted to catch a signal, perform some additional processing(such as deleting temporary files), restore the default signal action
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -