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

📄 ch04_07.htm

📁 unix基础教程
💻 HTM
字号:
<html><head><title>Invoking the Shell (UNIX in a Nutshell: System V Edition)</title><link rel="stylesheet" type="text/css" href="../style/style1.css" /><meta name="DC.Creator" content="Arnold Robbins" /><meta name="DC.Format" content="text/xml" scheme="MIME" /><meta name="DC.Language" content="en-US" /><meta name="DC.Publisher" content="O'Reilly &amp; Associates, Inc." /><meta name="DC.Source" scheme="ISBN" content="1-56592-427-4" /><meta name="DC.Subject.Keyword" content="stuff" /><meta name="DC.Title" content="UNIX in a Nutshell: System V Edition" /><meta name="DC.Type" content="Text.Monograph" /></head><body bgcolor="#ffffff"><img src="gifs/smbanner.gif" usemap="#banner-map" border="0" alt="Book Home" /><map name="banner-map"><area shape="rect" coords="1,-2,616,66" href="index.htm" alt="Book Title" /><area shape="rect" coords="629,-11,726,25" href="jobjects/fsearch.htm" alt="Search this book" /></map><div class="navbar"><table width="684" border="0"><tr><td align="left" valign="top" width="228"><a href="ch04_06.htm"><img src="../gifs/txtpreva.gif" alt="Previous" border="0" /></a></td><td align="center" valign="top" width="228" /><td align="right" valign="top" width="228"><a href="ch04_08.htm"><img src="../gifs/txtnexta.gif" alt="Next" border="0" /></a></td></tr></table></div><h2 class="sect1">4.7. Invoking the Shell</h2><p><a name="unut-ch-4-ix-ksh-korn-shell-invoking-shell" /><a name="unut-ch-4-ix-sh-bourne-shell-invoking-shell" /><a name="unut-ch-4-ix-invoking-the-shell" /><a name="unut-ch-4-ix-shells-invoking" />The command interpreter for the Bourne shell (<tt class="literal">sh</tt>)or the Korn shell (<tt class="literal">ksh</tt>) can be invoked as follows:</p><blockquote><pre class="code">sh   [<em class="replaceable"><tt>options</em>]  [<em class="replaceable">arguments</tt></em>]ksh  [<em class="replaceable"><tt>options</em>]  [<em class="replaceable">arguments</tt></em>]</pre></blockquote><p><tt class="literal">ksh</tt> and <tt class="literal">sh</tt> can execute commands from a terminal,from a file (when thefirst <em class="emphasis">argument</em> is an executable script), orfrom standard input (if no arguments remain or if <tt class="literal">-s</tt>is specified).<tt class="literal">ksh</tt> and <tt class="literal">sh</tt> automatically print prompts ifstandard input is a terminal, or if <tt class="literal">-i</tt> isgiven on the command line.</p><dl><dt><i><em class="emphasis">Arguments</em></tt></i></dt><dd>Arguments are assigned in order to the positional parameters<tt class="literal">$1</tt>, <tt class="literal">$2</tt>, etc.  If array assignment is in effect(<tt class="literal">-A</tt> or <tt class="literal">+A</tt>), arguments are assigned as arrayelements.  If the first argument is an executable script,commands are read from it, and the remaining arguments are assignedto <tt class="literal">$1</tt>, <tt class="literal">$2</tt>, etc.</p></dd><dt><i><em class="emphasis">Options</em></tt></i></dt><dd><dl><dt><tt class="literal">-c</tt> <tt><em class="replaceable">str</em></tt></dt><dd>Read commands from string <em class="emphasis">str</em></tt>.</p></dd><dt><tt class="literal">-D</tt></dt><dd>Print all <tt class="literal">$"..."</tt> strings in the program.<tt class="literal">ksh93</tt> only.</p></dd><dt><tt class="literal">-i</tt></dt><dd>Create an interactive shell (prompt for input).</p></dd><dt><tt class="literal">-I</tt> <tt><em class="replaceable">file</em></tt></dt><dd>Create a cross-reference database for variable and commanddefinitions and references.May not be compiled in.<tt class="literal">ksh93</tt> only.</p></dd><dt><tt class="literal">-p</tt></dt><dd>Start up as a privileged user (Bourne shell:don't set the effective user and group IDsto those of the real user and group IDs.Korn shell:don't process <tt class="literal">$HOME/.profile</tt>).</p></dd><dt><tt class="literal">-r</tt></dt><dd>Create a restricted shell (same as <tt class="literal">rksh</tt> or <tt class="literal">rsh</tt>).</p></dd><dt><tt class="literal">-s</tt></dt><dd>Read commands from standard input;output from built-in commands goes to file descriptor 1;all other shell output goes to file descriptor 2.</p></dd></dl></dd></dl><p>The remaining options to <tt class="literal">sh</tt> and <tt class="literal">ksh</tt> are listed under the <tt class="literal">set</tt> built-in command.<a name="IXT-4-122807" /><a name="IXT-4-122808" /><a name="IXT-4-122809" /><a name="IXT-4-122810" /></p><hr width="684" align="left" /><div class="navbar"><table width="684" border="0"><tr><td align="left" valign="top" width="228"><a href="ch04_06.htm"><img src="../gifs/txtpreva.gif" alt="Previous" border="0" /></a></td><td align="center" valign="top" width="228"><a href="index.htm"><img src="../gifs/txthome.gif" alt="Home" border="0" /></a></td><td align="right" valign="top" width="228"><a href="ch04_08.htm"><img src="../gifs/txtnexta.gif" alt="Next" border="0" /></a></td></tr><tr><td align="left" valign="top" width="228">4.6. Job Control</td><td align="center" valign="top" width="228"><a href="index/index.htm"><img src="../gifs/index.gif" alt="Book Index" border="0" /></a></td><td align="right" valign="top" width="228">4.8. Restricted Shells</td></tr></table></div><hr width="684" align="left" /><img src="../gifs/navbar.gif" usemap="#library-map" border="0" alt="Library Navigation Links" /><p><p><font size="-1"><a href="copyrght.htm">Copyright &copy; 2003</a> O'Reilly &amp; Associates. All rights reserved.</font></p><map name="library-map"><area shape="rect" coords="1,0,88,96" href="../index.htm"><area shape="rect" coords="90,0,165,96" href="../upt/index.htm"><area shape="rect" coords="168,1,253,107" href="../mac/index.htm"><area shape="rect" coords="255,0,335,97" href="../korn/index.htm"><area shape="rect" coords="337,0,415,109" href="../unixnut/index.htm"><area shape="rect" coords="417,0,512,122" href="../sedawk/index.htm"><area shape="rect" coords="514,0,605,105" href="../lunix/index.htm"><area shape="rect" coords="611,2,694,121" href="../vi/index.htm"></map></body></html>

⌨️ 快捷键说明

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