📄 ch03_02.htm
字号:
<html><head><title>Purpose of 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 & 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="ch03_01.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="ch03_03.htm"><img src="../gifs/txtnexta.gif" alt="Next" border="0" /></a></td></tr></table></div><h2 class="sect1">3.2. Purpose of the Shell</h2><p>There are three uses for the shell:</p><ul><li><p>Interactive use</p></li><li><p>Customization of your Unix session</p></li><li><p>Programming</p></li></ul><a name="unut-ch-3-sect-2.1" /><div class="sect2"><h3 class="sect2">3.2.1. Interactive Use</h3><p><a name="IXT-3-122625" />When the shell is used interactively,the system waits for you to type a command at the Unix prompt. Your commands can include special symbols that let you abbreviate filenames or redirect input and output.</p></div><a name="unut-ch-3-sect-2.2" /><div class="sect2"><h3 class="sect2">3.2.2. Customization of Your Unix Session</h3><p><a name="IXT-3-122626" /><a name="IXT-3-122627" /><a name="IXT-3-122628" />A Unix shell defines variables to control the behavior of your Unix session. Setting these variables willtell the system, for example, which directory to use as your home directory,or the file in which to store your mail.Some variables are preset by the system; you can define others in startup files that are read when you log in. Startup files can alsocontain Unix commands or special shell commands. These are executedevery time you log in.</p></div><a name="unut-ch-3-sect-2.3" /><div class="sect2"><h3 class="sect2">3.2.3. Programming</h3><p><a name="IXT-3-122629" /><a name="IXT-3-122630" />Unix shells provide a set of special (or built-in) commands that letyou create programs called <em class="emphasis">shell scripts</em>.In fact, many built-in commandscan be used interactively like Unix commands, and Unix commands arefrequently used in shell scripts. Scripts are useful for executing a seriesof individual commands. This is similar to BATCH files in MS-DOS.Scripts can also execute commands repeatedly (in a loop) or conditionally(<tt class="literal">if</tt>-<tt class="literal">else</tt>),as in many high-level programming languages.</p></div><hr width="684" align="left" /><div class="navbar"><table width="684" border="0"><tr><td align="left" valign="top" width="228"><a href="ch03_01.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="ch03_03.htm"><img src="../gifs/txtnexta.gif" alt="Next" border="0" /></a></td></tr><tr><td align="left" valign="top" width="228">3. The Unix Shell: An Overview</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">3.3. Shell Flavors</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 © 2003</a> O'Reilly & 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 + -