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

📄 sh.html

📁 IEEE 1003.1-2003, Single Unix Specification v3
💻 HTML
📖 第 1 页 / 共 5 页
字号:
<dt><b>[</b><i>count</i><b>]_</b></dt><dd>Append a &lt;space&gt; after the current character position and then append the last bigword in the previous input line afterthe &lt;space&gt;. Then enter insert mode after the last character just appended. With a number <i>count</i>, append the<i>count</i>th bigword in the previous line.</dd><dt><b>[</b><i>count</i><b>]x</b></dt><dd>Delete the character at the current cursor position and place the deleted characters in the save buffer. If the cursor waspositioned on the last character of the line, the character shall be deleted and the cursor position shall be moved to the previouscharacter (the new last character). If the <i>count</i> is larger than the number of characters after the cursor, this shall not beconsidered an error; all the characters from the cursor to the end of the line shall be deleted.</dd><dt><b>[</b><i>count</i><b>]X</b></dt><dd>Delete the character before the current cursor position and place the deleted characters in the save buffer. The characterunder the current cursor position shall not change. If the cursor was positioned on the first character of the line, the terminalshall be alerted, and the <b>X</b> command shall have no effect. If the line contained a single character, the <b>X</b> commandshall have no effect. If the line contained no characters, the terminal shall be alerted and the cursor shall not be moved. If the<i>count</i> is larger than the number of characters before the cursor, this shall not be considered an error; all the charactersfrom before the cursor to the beginning of the line shall be deleted.</dd><dt><b>[</b><i>count</i><b>]d</b><i>motion</i></dt><dd><br>Delete the characters between the current cursor position and the character position that would result from the motion command. Anumber <i>count</i> repeats the motion command <i>count</i> times. If the motion command would move toward the beginning of thecommand line, the character under the current cursor position shall not be deleted. If the motion command is <b>d</b>, the entirecurrent command line shall be cleared. If the <i>count</i> is larger than the number of characters between the current cursorposition and the end of the command line toward which the motion command would move the cursor, this shall not be considered anerror; all of the remaining characters in the aforementioned range shall be deleted. The deleted characters shall be placed in thesave buffer.</dd><dt><b>D</b></dt><dd>Delete all characters from the current cursor position to the end of the line. The deleted characters shall be placed in thesave buffer.</dd><dt><b>[</b><i>count</i><b>]y</b><i>motion</i></dt><dd><br>Yank (that is, copy) the characters from the current cursor position to the position resulting from the motion command into thesave buffer. A number <i>count</i> shall be applied to the motion command. If the motion command would move toward the beginning ofthe command line, the character under the current cursor position shall not be included in the set of yanked characters. If themotion command is <b>y</b>, the entire current command line shall be yanked into the save buffer. The current cursor position shallbe unchanged. If the <i>count</i> is larger than the number of characters between the current cursor position and the end of thecommand line toward which the motion command would move the cursor, this shall not be considered an error; all of the remainingcharacters in the aforementioned range shall be yanked.</dd><dt><b>Y</b></dt><dd>Yank the characters from the current cursor position to the end of the line into the save buffer. The current characterposition shall be unchanged.</dd><dt><b>[</b><i>count</i><b>]p</b></dt><dd>Put a copy of the current contents of the save buffer after the current cursor position. The current cursor position shall beadvanced to the last character put from the save buffer. A <i>count</i> shall indicate how many copies of the save buffer shall beput.</dd><dt><b>[</b><i>count</i><b>]P</b></dt><dd>Put a copy of the current contents of the save buffer before the current cursor position. The current cursor position shall bemoved to the last character put from the save buffer. A <i>count</i> shall indicate how many copies of the save buffer shall beput.</dd><dt><b>u</b></dt><dd>Undo the last command that changed the edit line. This operation shall not undo the copy of any command line to the editline.</dd><dt><b>U</b></dt><dd>Undo all changes made to the edit line. This operation shall not undo the copy of any command line to the edit line.</dd><dt><b>[</b><i>count</i><b>]k</b></dt><dt><b>[</b><i>count</i><b>]-</b></dt><dd>Set the current command line to be the <i>count</i>th previous command line in the shell command history. If <i>count</i> isnot specified, it shall default to 1. The cursor shall be positioned on the first character of the new command. If a <b>k</b> or<b>-</b> command would retreat past the maximum number of commands in effect for this shell (affected by the <i>HISTSIZE</i>environment variable), the terminal shall be alerted, and the command shall have no effect.</dd><dt><b>[</b><i>count</i><b>]j</b></dt><dt><b>[</b><i>count</i><b>]+</b></dt><dd>Set the current command line to be the <i>count</i>th next command line in the shell command history. If <i>count</i> is notspecified, it shall default to 1. The cursor shall be positioned on the first character of the new command. If a <b>j</b> or<b>+</b> command advances past the edit line, the current command line shall be restored to the edit line and the terminal shall bealerted.</dd><dt><b>[</b><i>number</i><b>]G</b></dt><dd>Set the current command line to be the oldest command line stored in the shell command history. With a number <i>number</i>,set the current command line to be the command line <i>number</i> in the history. If command line <i>number</i> does not exist, theterminal shall be alerted and the command line shall not be changed.</dd><dt><b>/</b><i>pattern</i>&lt;newline&gt;</dt><dd><br>Move backwards through the command history, searching for the specified pattern, beginning with the previous command line. Patternsuse the pattern matching notation described in <a href="xcu_chap02.html#tag_02_13"><i>Pattern Matching Notation</i></a> , exceptthat the <tt>'^'</tt> character shall have special meaning when it appears as the first character of <i>pattern</i>. In this case,the <tt>'^'</tt> is discarded and the characters after the <tt>'^'</tt> shall be matched only at the beginning of a line. Commandsin the command history shall be treated as strings, not as filenames. If the pattern is not found, the current command line shallbe unchanged and the terminal is alerted. If it is found in a previous line, the current command line shall be set to that line andthe cursor shall be set to the first character of the new command line. <p>If <i>pattern</i> is empty, the last non-empty pattern provided to <b>/</b> or <b>?</b> shall be used. If there is no previousnon-empty pattern, the terminal shall be alerted and the current command line shall remain unchanged.</p></dd><dt><b>?</b><i>pattern</i>&lt;newline&gt;</dt><dd><br>Move forwards through the command history, searching for the specified pattern, beginning with the next command line. Patterns usethe pattern matching notation described in <a href="xcu_chap02.html#tag_02_13"><i>Pattern Matching Notation</i></a> , except thatthe <tt>'^'</tt> character shall have special meaning when it appears as the first character of <i>pattern</i>. In this case, the<tt>'^'</tt> is discarded and the characters after the <tt>'^'</tt> shall be matched only at the beginning of a line. Commands inthe command history shall be treated as strings, not as filenames. If the pattern is not found, the current command line shall beunchanged and the terminal alerted. If it is found in a following line, the current command line shall be set to that line and thecursor shall be set to the fist character of the new command line. <p>If <i>pattern</i> is empty, the last non-empty pattern provided to <b>/</b> or <b>?</b> shall be used. If there is no previousnon-empty pattern, the terminal shall be alerted and the current command line shall remain unchanged.</p></dd><dt><b>n</b></dt><dd>Repeat the most recent <b>/</b> or <b>?</b> command. If there is no previous <b>/</b> or <b>?</b>, the terminal shall bealerted and the current command line shall remain unchanged.</dd><dt><b>N</b></dt><dd>Repeat the most recent <b>/</b> or <b>?</b> command, reversing the direction of the search. If there is no previous <b>/</b> or<b>?</b>, the terminal shall be alerted and the current command line shall remain unchanged.</dd></dl></blockquote><h4><a name="tag_04_128_14"></a>EXIT STATUS</h4><blockquote><p>The following exit values shall be returned:</p><dl compact><dt>&nbsp;&nbsp;&nbsp;&nbsp;0</dt><dd>The script to be executed consisted solely of zero or more blank lines or comments, or both.</dd><dt>1-125</dt><dd>A non-interactive shell detected a syntax, redirection, or variable assignment error.</dd><dt>&nbsp;&nbsp;127</dt><dd>A specified <i>command_file</i> could not be found by a non-interactive shell.</dd></dl><p>Otherwise, the shell shall return the exit status of the last command it invoked or attempted to invoke (see also the <a href="../utilities/exit.html"><i>exit</i></a> utility in <a href="xcu_chap02.html#tag_02_14"><i>Special Built-InUtilities</i></a> ).</p></blockquote><h4><a name="tag_04_128_15"></a>CONSEQUENCES OF ERRORS</h4><blockquote><p>See <a href="xcu_chap02.html#tag_02_08_01"><i>Consequences of Shell Errors</i></a> .</p></blockquote><hr><div class="box"><em>The following sections are informative.</em></div><h4><a name="tag_04_128_16"></a>APPLICATION USAGE</h4><blockquote><p>Standard input and standard error are the files that determine whether a shell is interactive when <b>-i</b> is not specified.For example:</p><pre><tt>sh &gt; file</tt></pre><p>and:</p><pre><tt>sh 2&gt; file</tt></pre><p>create interactive and non-interactive shells, respectively. Although both accept terminal input, the results of errorconditions are different, as described in <a href="xcu_chap02.html#tag_02_08_01"><i>Consequences of Shell Errors</i></a> ; in thesecond example a redirection error encountered by a special built-in utility aborts the shell.</p><p>A conforming application must protect its first operand, if it starts with a plus sign, by preceding it with the <tt>"--"</tt>argument that denotes the end of the options.</p><p>Applications should note that the standard <i>PATH</i> to the shell cannot be assumed to be either <b>/bin/sh</b> or<b>/usr/bin/sh</b>, and should be determined by interrogation of the <i>PATH</i> returned by <a href="../utilities/getconf.html"><i>getconf</i></a> <i>PATH ,</i> ensuring that the returned pathname is an absolute pathname and not ashell built-in.</p><p>For example, to determine the location of the standard <i>sh</i> utility:</p><pre><tt>command -v sh</tt></pre><p>On some implementations this might return:</p><pre><tt>/usr/xpg4/bin/sh</tt></pre><p>Furthermore, on systems that support executable scripts (the <tt>"#!"</tt> construct), it is recommended that applications usingexecutable scripts install them using <a href="../utilities/getconf.html"><i>getconf</i></a> <b>-v</b> to determine the shellpathname and update the <tt>"#!"</tt> script appropriately as it is being installed (for example, with <a href="../utilities/sed.html"><i>sed</i></a>). For example:</p><pre><tt>## Installation time script to install correct POSIX shell pathname## Get list of paths to check#Sifs=$IFSIFS=:set $(getconf PATH)IFS=$Sifs## Check each path for 'sh'#for i in $@do    if [ -f ${i}/sh ];    then        Pshell=${i}/sh    fidone## This is the list of scripts to update. They should be of the# form '${name}.source' and will be transformed to '${name}'.# Each script should begin:

⌨️ 快捷键说明

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