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

📄 sh.html

📁 unix 下的C开发手册,还用详细的例程。
💻 HTML
📖 第 1 页 / 共 4 页
字号:
current cursor position will not be deleted.If the motion command would move the current cursor positiontoward the end of the command line, the character under thecurrent cursor position will be deleted.If the<i>count</i>is larger than the number of charactersbetween the current cursor position and the end of thecommand line toward which the motion command would movethe cursor, this is not considered an error; allof the remaining characters in the aforementioned rangewill be deleted and insert mode will be entered.If the motion command is invalid,the terminal will be alerted,the cursorwill not be moved, and no text will be deleted.<dt><b>C</b><dd>Delete from the current character to the end of the line andenter insert mode at the new end-of-line.<dt><b>S</b><dd>Clear the entire current command line and enter insert mode.<dt><b>[</b><i>count</i><b>]r</b><i>c</i><dd>Replace the current character with the character<i>c</i>.With a number<i>count</i>,replace the current and the following<i>count</i>-1characters.After this command, the current cursor position will beon the last character that was changed.If the<i>count</i>is larger than the number of characters after the cursor,this is not considered an error;all of the remaining characters will be changed.<dt><b>[</b><i>count</i><b>]_</b><dd>Append aspace characterafter the current character position and thenappend the last bigword in the previous input line after thespace character.Then enter insert mode after the last character just appended.With a number<i>count</i>,append the<i>count</i>thbigword in the previous line.<dt><b>[</b><i>count</i><b>]x</b><dd>Delete the character at the current cursor positionand place the deleted characters in the save buffer.If the cursor was positioned on the last character of the line,the character will be deleted and the cursor positionwill be moved to the previous character (the new last character).If the<i>count</i>is larger than the number of characters after the cursor,this is not considered an error;all the characters from the cursor to the end of the line will be deleted.<dt><b>[</b><i>count</i><b>]X</b><dd>Delete the character before the current cursor positionand place the deleted characters in the save buffer.The character under the current cursor positionwill not change.If the cursor was positioned on the first character of the line,the terminal will be alerted,and the<b>X</b>command will have no effect.If the line contained a single character, the<b>X</b>command will have no effect.If the line contained no characters,the terminal will be alertedand the cursor will not be moved.If the<i>count</i>is larger than the number of characters before the cursor,this is not considered an error;all the characters from before the cursor to the beginningof the line will be deleted.<dt><b>[</b><i>count</i><b>]d</b><i>motion</i><dd>Delete the characters between the current cursor position and thecharacter position that would result from the<i>motion</i>command.A number<i>count</i>repeats the<i>motion</i>command<i>count</i>times.If the motioncommand would move toward the beginning of the command line,the character under the current cursor positionwill not be deleted.If the motion command is<b>d</b>,the entire current command line will be cleared.If the<i>count</i>is larger than the number of charactersbetween the current cursor position and the end of thecommand line toward which the motion command would movethe cursor, this is not considered an error; allof the remaining characters in the aforementioned rangewill be deleted.The deleted characters will be placed in the save buffer.<dt><b>D</b><dd>Delete all characters from the current cursor positionto the end of the line.The deleted characters will be placed in the save buffer.<dt><b>[</b><i>count</i><b>]y</b><i>motion</i><dd>Yank (that is, copy) the characters from the current cursor position to theposition resulting from the<i>motion</i>command into asave buffer.A number<i>count</i>will be applied to the<i>motion</i>command.If the motioncommand would move toward the beginning of the command line,the character under the current cursor positionwill not be included in the set of yanked characters.If the motion command is<b>y</b>,the entire current command line will be yanked into the save buffer.The current cursor position will be unchanged.If the<i>count</i>is larger than the number of charactersbetween the current cursor position and the end of thecommand line toward which the motion command would movethe cursor, this is not considered an error; allof the remaining characters in the aforementioned rangewill be yanked.<dt><b>Y</b><dd>Yank the characters from the current cursor position to theend of the line into the save buffer.The current character position will be unchanged.<dt><b>[</b><i>count</i><b>]p</b><dd>Put a copy of the current contents of the save bufferafter the current cursor position.The current cursor position will beadvanced to the last character put from the save buffer.A<i>count</i>indicates how many copies of the save buffer will be put.<dt><b>[</b><i>count</i><b>]P</b><dd>Put a copy of the current contents of the save bufferbefore the current cursor position.The current cursor position will bemoved to the last character put from the save buffer.A<i>count</i>indicates how many copies of the save buffer will be put.<dt><b>u</b><dd>Undo the last command that modified the text of the current command line.<dt><b>U</b><dd>Undo all changes made to the current command line since first enteringcommand mode on the line.<dt><b>[</b><i>count</i><b>]k</b><dd><dt><b>[</b><i>count</i><b>]-</b><dd>Replace the current command line with the previous command linein the shell command history.The cursor will be positioned on the first character of the new command.A count preceding the commandwill have the same effect as executing the command<i>count</i>times.If a<b>k</b>or "-"command retreats past the maximum number of commandsin effect for this shell (affected by the<i>HISTSIZE</i>environment variable),the terminal will be alertedand the command will have no effect.<dt><b>[</b><i>count</i><b>]j</b><dd><dt><b>[</b><i>count</i><b>]+</b><dd>Replace the current command line with the next command linein the shell command history.The cursor will be positioned on the first character of the new command.The command history position will be remembered, and any<b>k</b>or "-" command, or<b>j</b>or + command, will decrement or increment thatposition and then will fetch the line at the new position.If a<b>j</b>orcommand advances past the most recent line inthe history, the current command line will be restored to the contentsbefore the first<b>k</b>or "-".<dt><b>[</b><i>number</i><b>]G</b><dd>Replace the current command line with the contents of the oldestcommand line stored in the shell command history.With a number<i>number</i>,replace the current command line with the contents of command<i>number</i>in the history.<dt><b>/</b><i>string</i>&lt;newline&gt;<dd>Move backward through the command history, searchingfor the specified<i>string</i>,beginning with the previous command line.If it is not found, the current command line will be unchanged.If it is found in a previous line, this commandwill behave equivalently to a set of<b>k</b>commands to reach that line.If<i>string</i>begins with "^", the characters after the "^"will be matched only at the beginning of a line.<dt><b>?</b><i>string</i>&lt;newline&gt;<dd>Move forward through the command history, searching for the specified string.If it isnot found, the current command line will be unchanged.If the stringis found in the current command line, the current cursor position will bemoved to the beginning of that string.If it is found in thehistory, this command will behave equivalently to a set of<b>j</b>commands to reach that line.If<i>string</i>begins with "^",the characters after the "^" will be matched only at thebeginning of a line.<dt><b>n</b><dd>Repeat the most recent <b>/</b> or <b>?</b> command.<dt><b>N</b><dd>Repeat the most recent <b>/</b> or <b>?</b> command, reversing the directionof the search.</dl></blockquote><h4><a name = "tag_001_014_2005">&nbsp;</a>EXIT STATUS</h4><blockquote>The following exit values are returned:<dl compact><dt>0<dd>The script to be executed consisted solelyof zero or more blank lines or comments, or both.<dt>1-125<dd>A non-interactive shell detected a syntax,redirection or variable assignment error.<dt>127<dd>A specified<i>command_file</i>could not be found by a non-interactive shell.</dl><p>Otherwise, the shell will return the exit status ofthe last command it invoked or attempted to invoke (see also the<i><a href="chap2.html#tag_001_014_007">exit</a></i>utility in<xref href=sbi><a href="chap2.html#tag_001_014">Special Built-in Utilities</a></xref>).</blockquote><h4><a name = "tag_001_014_2006">&nbsp;</a>CONSEQUENCES OF ERRORS</h4><blockquote>See<xref href=sherr><a href="chap2.html#tag_001_008_001">Consequences of Shell Errors</a></xref>.</blockquote><h4><a name = "tag_001_014_2007">&nbsp;</a>APPLICATION USAGE</h4><blockquote>Standard input and standard error are the files thatdetermine whether a shell is interactive when<b>-i</b>is not specified.For example:<pre><code>sh &gt; file</code></pre>and:<pre><code>sh 2&gt; file</code></pre>create interactive and non-interactive shells, respectively.Although both accept terminal input, the results oferror conditions are different, as described in<xref href=sherr><a href="chap2.html#tag_001_008_001">Consequences of Shell Errors</a></xref>;in the second example a redirection error encountered by aspecial built-in utility will abort the shell.<p>On systems that support set-user-ID scripts,a historical trapdoor has been to link a script to the name<b>-i</b>.When it is called by a sequence such as:<pre><code>sh -</code></pre>or by:<pre><code>#!&nbsp;/bin/sh&nbsp;-</code></pre>the historical systems have assumed that no option letters follow.Thus, this specification allows the single hyphen to markthe end of the options, in addition to the use of the regular--argument, because the older practice is so pervasive.<p>A portable application must protect its first operand,if it starts with a plus sign,by preceding it with the --argument that denotes the end of the options.<br></blockquote><h4><a name = "tag_001_014_2008">&nbsp;</a>EXAMPLES</h4><blockquote><ol><p><li>Execute a shell command from a string:<pre><code>sh -c "cat myfile"</code></pre><p><li>Execute a shell script from a file in the current directory:<pre><code>sh my_shell_cmds</code></pre><p></ol></blockquote><h4><a name = "tag_001_014_2009">&nbsp;</a>FUTURE DIRECTIONS</h4><blockquote>The IEEE PASC 1003.2 Interpretations Committee has forwarded concerns aboutparts of this interface definition to the IEEE PASC Shell and Utilities Working Groupwhich is identifying the corrections.A future revision of this specification will align withIEEE Std. 1003.2b when finalised.</blockquote><h4><a name = "tag_001_014_2010">&nbsp;</a>SEE ALSO</h4><blockquote><i><a href="cd.html">cd</a></i>,<i><a href="echo.html">echo</a></i>,<i><a href="pwd.html">pwd</a></i>,<i><a href="test.html">test</a></i>,<i><a href="umask.html">umask</a></i>,the <b>XSH</b> specification description of<i><a href="../xsh/dup.html">dup()</a></i>,<i>exec ,</i><i><a href="../xsh/exit.html">exit()</a></i>,<i><a href="../xsh/fork.html">fork()</a></i>,<i><a href="../xsh/pipe.html">pipe()</a></i>,<i><a href="../xsh/signal.html">signal()</a></i>,<i><a href="../xsh/system.html">system()</a></i>,<i><a href="../xsh/ulimit.html">ulimit()</a></i>,<i><a href="../xsh/umask.html">umask()</a></i>,<i><a href="../xsh/wait.html">wait()</a></i>.</blockquote><hr size=2 noshade><center><font size=2>UNIX &reg; is a registered Trademark of The Open Group.<br>Copyright &copy; 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 + -