⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 kill.html

📁 IEEE 1003.1-2003, Single Unix Specification v3
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<blockquote><p>The following environment variables shall affect the execution of <i>kill</i>:</p><dl compact><dt><i>LANG</i></dt><dd>Provide a default value for the internationalization variables that are unset or null. (See the Base Definitions volume ofIEEE&nbsp;Std&nbsp;1003.1-2001, <a href="../basedefs/xbd_chap08.html#tag_08_02">Section 8.2, Internationalization Variables</a> forthe precedence of internationalization variables used to determine the values of locale categories.)</dd><dt><i>LC_ALL</i></dt><dd>If set to a non-empty string value, override the values of all the other internationalization variables.</dd><dt><i>LC_CTYPE</i></dt><dd>Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte asopposed to multi-byte characters in arguments).</dd><dt><i>LC_MESSAGES</i></dt><dd>Determine the locale that should be used to affect the format and contents of diagnostic messages written to standarderror.</dd><dt><i>NLSPATH</i></dt><dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">Determine the location of message catalogs for the processing of <i>LC_MESSAGES .</i> <img src="../images/opt-end.gif" alt="[Option End]" border="0"></dd></dl></blockquote><h4><a name="tag_04_72_09"></a>ASYNCHRONOUS EVENTS</h4><blockquote><p>Default.</p></blockquote><h4><a name="tag_04_72_10"></a>STDOUT</h4><blockquote><p>When the <b>-l</b> option is not specified, the standard output shall not be used.</p><p>When the <b>-l</b> option is specified, the symbolic name of each signal shall be written in the following format:</p><pre><tt>"%s%c", &lt;</tt><i>signal_name</i><tt>&gt;, &lt;</tt><i>separator</i><tt>&gt;</tt></pre><p>where the &lt;<i>signal_name</i>&gt; is in uppercase, without the <b>SIG</b> prefix, and the &lt;<i>separator</i>&gt; shall beeither a &lt;newline&gt; or a &lt;space&gt;. For the last signal written, &lt;<i>separator</i>&gt; shall be a &lt;newline&gt;.</p><p>When both the <b>-l</b> option and <i>exit_status</i> operand are specified, the symbolic name of the corresponding signal shallbe written in the following format:</p><pre><tt>"%s\n", &lt;</tt><i>signal_name</i><tt>&gt;</tt></pre></blockquote><h4><a name="tag_04_72_11"></a>STDERR</h4><blockquote><p>The standard error shall be used only for diagnostic messages.</p></blockquote><h4><a name="tag_04_72_12"></a>OUTPUT FILES</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_04_72_13"></a>EXTENDED DESCRIPTION</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_04_72_14"></a>EXIT STATUS</h4><blockquote><p>The following exit values shall be returned:</p><dl compact><dt>&nbsp;0</dt><dd>At least one matching process was found for each <i>pid</i> operand, and the specified signal was successfully processed for atleast one matching process.</dd><dt>&gt;0</dt><dd>An error occurred.</dd></dl></blockquote><h4><a name="tag_04_72_15"></a>CONSEQUENCES OF ERRORS</h4><blockquote><p>Default.</p></blockquote><hr><div class="box"><em>The following sections are informative.</em></div><h4><a name="tag_04_72_16"></a>APPLICATION USAGE</h4><blockquote><p>Process numbers can be found by using <a href="../utilities/ps.html"><i>ps</i></a>.</p><p>The job control job ID notation is not required to work as expected when <i>kill</i> is operating in its own utility executionenvironment. In either of the following examples:</p><pre><tt>nohup kill %1 &amp;system("kill %1");</tt></pre><p>the <i>kill</i> operates in a different environment and does not share the shell's understanding of job numbers.</p></blockquote><h4><a name="tag_04_72_17"></a>EXAMPLES</h4><blockquote><p>Any of the commands:</p><pre><tt>kill -9 100 -165kill -s kill 100 -165kill -s KILL 100 -165</tt></pre><p>sends the SIGKILL signal to the process whose process ID is 100 and to all processes whose process group ID is 165, assuming thesending process has permission to send that signal to the specified processes, and that they exist.</p><p>The System Interfaces volume of IEEE&nbsp;Std&nbsp;1003.1-2001 and this volume of IEEE&nbsp;Std&nbsp;1003.1-2001 do not requirespecific signal numbers for any <i>signal_names</i>. Even the <b>-</b> <i>signal_number</i> option provides symbolic (althoughnumeric) names for signals. If a process is terminated by a signal, its exit status indicates the signal that killed it, but theexact values are not specified. The <i>kill</i> <b>-l</b> option, however, can be used to map decimal signal numbers and exitstatus values into the name of a signal. The following example reports the status of a terminated job:</p><pre><tt>jobstat=$?if [ $stat -eq 0 ]then    echo job completed successfully.elif [ $stat -gt 128 ]then    echo job terminated by signal SIG$(kill -l $stat).else    echo job terminated with error code $stat.fi</tt></pre><p>To send the default signal to a process group (say 123), an application should use a command similar to one of thefollowing:</p><pre><tt>kill -TERM -123kill -- -123</tt></pre></blockquote><h4><a name="tag_04_72_18"></a>RATIONALE</h4><blockquote><p>The <b>-l</b> option originated from the C shell, and is also implemented in the KornShell. The C shell output can consist ofmultiple output lines because the signal names do not always fit on a single line on some terminal screens. The KornShell outputalso included the implementation-defined signal numbers and was considered by the standard developers to be too difficult forscripts to parse conveniently. The specified output format is intended not only to accommodate the historical C shell output, butalso to permit an entirely vertical or entirely horizontal listing on systems for which this is appropriate.</p><p>An early proposal invented the name SIGNULL as a <i>signal_name</i> for signal 0 (used by the System Interfaces volume ofIEEE&nbsp;Std&nbsp;1003.1-2001 to test for the existence of a process without sending it a signal). Since the <i>signal_name</i> 0can be used in this case unambiguously, SIGNULL has been removed.</p><p>An early proposal also required symbolic <i>signal_name</i>s to be recognized with or without the <b>SIG</b> prefix. Historicalversions of <i>kill</i> have not written the <b>SIG</b> prefix for the <b>-l</b> option and have not recognized the <b>SIG</b>prefix on <i>signal_name</i>s. Since neither applications portability nor ease-of-use would be improved by requiring thisextension, it is no longer required.</p><p>To avoid an ambiguity of an initial negative number argument specifying either a signal number or a process group,IEEE&nbsp;Std&nbsp;1003.1-2001 mandates that it is always considered the former by implementations that support the XSI option. Italso requires that conforming applications always use the <tt>"--"</tt> options terminator argument when specifying a processgroup, unless an option is also specified.</p><p>The <b>-s</b> option was added in response to international interest in providing some form of <i>kill</i> that meets theUtility Syntax Guidelines.</p><p>The job control job ID notation is not required to work as expected when <i>kill</i> is operating in its own utility executionenvironment. In either of the following examples:</p><pre><tt>nohup kill %1 &amp;system("kill %1");</tt></pre><p>the <i>kill</i> operates in a different environment and does not understand how the shell has managed its job numbers.</p></blockquote><h4><a name="tag_04_72_19"></a>FUTURE DIRECTIONS</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_04_72_20"></a>SEE ALSO</h4><blockquote><p><a href="xcu_chap02.html#tag_02"><i>Shell Command Language</i></a> , <a href="ps.html"><i>ps</i></a> , <a href="wait.html"><i>wait</i>()</a> , the System Interfaces volume of IEEE&nbsp;Std&nbsp;1003.1-2001, <a href="../functions/kill.html"><i>kill</i>()</a>, the Base Definitions volume of IEEE&nbsp;Std&nbsp;1003.1-2001, <a href="../basedefs/signal.h.html"><i>&lt;signal.h&gt;</i></a></p></blockquote><h4><a name="tag_04_72_21"></a>CHANGE HISTORY</h4><blockquote><p>First released in Issue 2.</p></blockquote><h4><a name="tag_04_72_22"></a>Issue 6</h4><blockquote><p>The obsolescent versions of the SYNOPSIS are turned into non-obsolescent features of the XSI option, corresponding to a similarchange in the <a href="../utilities/trap.html"><i>trap</i></a> special built-in.</p></blockquote><div class="box"><em>End of informative text.</em></div><hr><hr size="2" noshade><center><font size="2"><!--footer start-->UNIX &reg; is a registered Trademark of The Open Group.<br>POSIX &reg; is a registered Trademark of The IEEE.<br>[ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href="../utilities/contents.html">XCU</a> | <a href="../functions/contents.html">XSH</a> | <a href="../xrat/contents.html">XRAT</a>]</font></center><!--footer end--><hr size="2" noshade></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -