?? ch04_06.htm
字號:
<html><head><title>Job Control (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="ch04_05.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_07.htm"><img src="../gifs/txtnexta.gif" alt="Next" border="0" /></a></td></tr></table></div><h2 class="sect1">4.6. Job Control</h2><p><a name="unut-ch-4-ix-ksh-korn-shell-job-control" /><a name="unut-ch-4-ix-sh-bourne-shell-job-control" /><a name="unut-ch-4-ix-job-control-for-sh-and-ksh-shells-sh-and-ksh-shells" />Job control lets you place foreground jobs in the background,bring background jobs to the foreground, or suspend(temporarily stop) running jobs. Job controlis enabled by any of the following commands:</p><blockquote><pre class="code">jsh -i <i class="lineannotation">Bourne shell</i>ksh -m -i <i class="lineannotation">Korn shell (same as next two)</i>set -mset -o monitor</pre></blockquote><p><a name="IXT-4-122803" />Many job control commands take a <em class="emphasis">jobID</em> as an argument.This argument can be specified as follows:</p><dl><dt><tt class="literal">%</tt><tt><em class="replaceable">n</em></tt></dt><dd>Job number <em class="emphasis">n</em></tt>.</p></dd><dt><tt class="literal">%</tt><tt><em class="replaceable">s</em></tt></dt><dd>Job whose command line starts with string <em class="emphasis">s</em></tt>.</p></dd><dt><tt class="literal">%?</tt><tt><em class="replaceable">s</em></tt></dt><dd>Job whose command line contains string <em class="emphasis">s</em></tt>.</p></dd><dt><tt class="literal">%%</tt></dt><dd>Current job.</p></dd><dt><tt class="literal">%+</tt></dt><dd>Current job (same as above).</p></dd><dt><tt class="literal">%-</tt></dt><dd>Previous job.</p></dd></dl><p>The Bourne and Korn shells provide the following job control commands. For more information on these commands, see <a href="ch04_09.htm#unut-ch-4-sect-9">Section 4.9</a> later in this chapter.</p><dl><dt><tt class="literal">bg</tt></dt><dd>Put a job in the background.</p></dd><dt><tt class="literal">fg</tt></dt><dd>Put a job in the foreground.</p></dd><dt><tt class="literal">jobs</tt></dt><dd>List active jobs.</p></dd><dt><tt class="literal">kill</tt></dt><dd>Terminate a job.</p></dd><dt><tt class="literal">stop</tt></dt><dd>Suspend a background job.</p></dd><dt><tt class="literal">stty tostop</tt></dt><dd>Stop background jobs if they try to send output to the terminal.(Note that <tt class="literal">stty</tt> is not a built-in command.)</p></dd><dt><tt class="literal">suspend</tt></dt><dd>Suspend a job-control shell (such as one created by <tt class="literal">su</tt>).</p></dd><dt><tt class="literal">wait</tt></dt><dd>Wait for background jobs to finish.</p></dd><dt><tt class="literal">CTRL-Z</tt></dt><dd>Suspend a foreground job. Then use <tt class="literal">bg</tt> or <tt class="literal">fg</tt>. (Yourterminal may use something other than <tt class="literal">CTRL-Z</tt> as the suspendcharacter.)</p></dd></dl><a name="IXT-4-122804" /><a name="IXT-4-122805" /><a name="IXT-4-122806" /><hr width="684" align="left" /><div class="navbar"><table width="684" border="0"><tr><td align="left" valign="top" width="228"><a href="ch04_05.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_07.htm"><img src="../gifs/txtnexta.gif" alt="Next" border="0" /></a></td></tr><tr><td align="left" valign="top" width="228">4.5. Command History</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.7. Invoking the Shell</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>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -