📄 utildes.html
字号:
(or action inherited from the parent process) and resignal itself.<dt><B>STDOUT</B><dd>The STDOUT section describes the standard outputof the utility.This section is frequently merely a reference tothe following section, OUTPUT FILES,because many utilities treat standard outputand output files in the same manner.Use of a terminal for standard output may causeany of the standard utilities that write standard outputto stop when used in the background.For this reason, applications should not use interactive features inscripts to be placed in the background.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 the <B>XBD</B> specification, <a href="../xbd/notation.html"><B>File Format Notation</B> </a> for a description of this notation.The specified standard output of the standard utilitiesdoes not depend on the existence or value of theenvironment variables defined in this specification, exceptas provided by this specification.Some of the standard utilitiesdescribe their output using the verb<I>display</I>,defined in the <B>XBD</B> specification, <a href="../xbd/glossary.html"><B>Glossary</B> </a> .Output described in the STDOUT sectionsof such utilities may be produced using means other than standard output.When standard output is directed to a terminal,the output described will be written directlyto the terminal.Otherwise, the results are undefined.<B>Default Behaviour:</B>When this section is listed as "Not used",it means that the standard output will not be writtenwhen the utility is used as described by this specification.<dt><B>STDERR</B><dd>The STDERR section describes the standard error outputof the utility.Only those messages that are purposely sent by theutility are described.Use of a terminal for standard error may causeany of the standard utilities that write standard error outputto stop when used in the background.For this reason, applications should not use interactive features inscripts to be placed in the background.The format of diagnostic messages for most utilitiesis unspecified, but the language and cultural conventionsof diagnostic and informative messages whose format isunspecified by this standard should be affected bythe setting of<i>LC_MESSAGES</i>and<i>NLSPATH .</i>The specified standard error output of standard utilitiesdoes not depend on the existence or value ofthe environment variables defined in this specification, exceptas provided by this specification.<B>Default Behaviour:</B>When this section is listed as "Used only for diagnostic messages,"it means that, unless otherwise stated,the diagnostic messages are sentto the standard error only when the exit status is non-zeroand the utility is used as described by this specification.When this section is listed as "Not used",it means that the standard error will not be usedwhen the utility is used as described in this specification.This section does not describe error messagesthat refer to incorrect operation of the utility.Consider a utility that processes program source code as its input.This section is used to describe messages produced by acorrectly operating utility that encounters an error in the programsource code on which it is processing.However, a message indicatingthat the utility had insufficient memory in which to operate would notbe described.Some compilers have traditionally produced warning messageswithout returning a non-zero exit status;these are specifically noted in their sections.Other utilities are expected to remain absolutely quiet onthe standard error if they want to return zero,unless the implementation provides some sort of extensionto increase the verbosity or debugging level.<dt><B>OUTPUT FILES</B><dd>The OUTPUT FILES section describes the files created or modifiedby the utility.Temporary or system files that are created for internal usageby this utility or other parts of the implementation(for example, spool, log and audit files)are not described in this, or any, section.The utilities creating such filesand the names of such files are unspecified.If applications are written to use temporary or intermediatefiles, they should use the<i>TMPDIR</i>environment variable, if it is set andrepresents an accessible directory,to select the location of temporary files.Temporary files used by the standard utilitiesare named so that different utilities or multipleinstances of the same utility can operatesimultaneously without regard to their workingdirectories, or any other process characteristic otherthan process ID.There are two exceptions to this rule:<ol><li>Resources for temporary files other thanthe name space (for example, disk space,available directory entries, or number ofprocesses allowed) are not guaranteed.<li>Certain standard utilities generate output filesthat are intended as input for other utilities,(for example,<i><a href="lex.html">lex</a></i>generates<b>lex.yy.c )</b>and these cannot have unique names.These cases are explicitly identified in thedescriptions of the respective utilities.</ol>Any temporary file created by the implementation is removedby the implementation upon a utility's successful exit,exit because of errors, or before termination by any of theSIGHUP, SIGINT or SIGTERM signals,unless specified otherwise by the utility description.Receipt of the SIGQUIT signal should generally cause termination(unless in some debugging mode) that would bypass any attemptedrecovery actions.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 the <B>XBD</B> specification, <a href="../xbd/notation.html"><B>File Format Notation</B> </a> for a description of this notation.<B>Default Behaviour:</B>When this section is listed as "None",it meansthat no files are created or modified as a consequence of directaction on the part of the utility when the utility is used as describedby this specification.However, the utility may create or modify system files,such as log files, that are outside the utility's normalexecution environment.<dt><B>EXTENDED DESCRIPTION</B><dd>The EXTENDED DESCRIPTIONsection provides a place for describing the actions of verycomplicated utilities, such as text editors or language processors,which typically have elaborate command languages.<B>Default Behaviour:</B>When this section is listed as "None",no further description is necessary.<dt><B>EXIT STATUS</B><dd>The EXIT STATUSsection describes the values the utility will return to thecalling program, or shell,and the conditions that cause these values to be returned.Usually, utilities return zero for successful completionand values greater than zero for various error conditions.If specific numeric values are listed in this section,the system will use those values for theerrors described.In some cases, status values are listed more loosely,such as ">0".A portable applicationcannot rely on any specific value in the rangeshown and must be prepared to receive any value in the range.For example, a utility may list zero as a successful return,1 as a failure for a specific reason, and >1 as "anerror occurred".In this case, unspecified conditions may cause a 2 or 3, orother value, to be returned.A portable applicationshould be written so that it tests for successfulexit status values (zero in this case),rather than relying upon the singlespecific error value listed in this specification.In that way, it will have maximum portability, even onimplementations with extensions.Unspecified error conditions may be representedby specific values not listed in this specification.<dt><B>CONSEQUENCES OF ERRORS</B><dd>The CONSEQUENCES OF ERRORSsection describes the effects on the environment, file systems,process state, and so on, when error conditions occur.It does not describe error messages producedor exit status values used.The many reasons for failure of a utilityare generally not specified by the utility descriptions.Utilities may terminate prematurely if they encounter:invalid usage of options, arguments or environmentvariables; invalid usage of the complex syntaxes expressed inEXTENDED DESCRIPTION sections; difficulties accessing,creating, reading or writing files; ordifficulties associated with the privileges of the process.The following apply to each utility, unless otherwise stated:<ul><li>If the requested action cannot be performedon an operand representing a file, directory, user, process,and so on, the utility will issuea diagnostic message to standard error and continue processing thenext operand in sequence, but the final exit status isreturned as non-zero.For a utility that recursively traverses a file hierarchy (such as<i><a href="find.html">find</a></i>or<i><a href="chown.html">chown</a></i><b>-R</b>),if the requested action cannot be performed on a file or directoryencountered in the hierarchy, the utility will issue a diagnostic message tostandard error and continue processing the remaining files in the hierarchy,but the final exit status will be returned as non-zero.<li>If the requested action characterised by an option or option-argumentcannot be performed, the utility will issue a diagnostic message tostandard error and the exit status returned will be non-zero.<li>When an unrecoverable error conditionis encountered, the utility will exit with a non-zero exit status.<li>A diagnostic message will be written to standard error whenever an errorcondition occurs.</ul>When a utility encounters an error condition several actions arepossible, depending on the severity of the error and the state of the utility.Included in the possible actions of various utilities are:deletion of temporary or intermediate work files; deletion ofincomplete files; validity checking of the file system or directory.<B>Default Behaviour:</B>When this section is listed as "Default",it means thatany changes to the environment are unspecified.<dt><B>APPLICATION USAGE</B><dd>The APPLICATION USAGE section gives advice to the application programmeror user about the way the utility should be used.<dt><B>EXAMPLES</B><dd>The EXAMPLES section gives one or more examples of usage, where appropriate.This section is non-normative. In the event of conflict between an example and a normative part of the specification, the normative material is to be taken as correct.In all examples, quoting has been used, showing how samplecommands (utility names combined with arguments) could be passedcorrectly to a shell(see<i><a href="sh.html">sh</a></i>)or as a string to the <B>XSH</B> specification<i><a href="../xsh/system.html">system()</a></i>function.Such quoting would not be used if the utility is invokedusing one of the <B>XSH</B> specification<I>exec</I>functions.<dt><B>FUTURE DIRECTIONS</B><dd>The FUTURE DIRECTIONS sectionshould be used as a guide to current thinking;there is not necessarily a commitment to implementall of these future directions in their entirety.<dt><B>SEE ALSO</B><dd>The SEE ALSO section lists related entries.</dl><p>Certain of the standard utilities describe how they can invokeother utilities or applications, such as by passing a command stringto the command interpreter.The external influences (STDIN, ENVIRONMENT VARIABLES, and so on)and external effects (STDOUT, CONSEQUENCES OF ERRORS, and so on)of such invoked utilitiesare not described in the section concerningthe standard utility that invokes them.</blockquote><hr size=2 noshade><center><font size=2>UNIX ® is a registered Trademark of The Open Group.<br>Copyright © 1997 The Open Group<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]</font></center><hr size=2 noshade></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -