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

📄 ch05_08.htm

📁 unix基础教程
💻 HTM
📖 第 1 页 / 共 4 页
字号:
By default, the current limits are shown or set; with <tt class="literal">-h</tt>, hard limits are used.  A hard limit imposes an absolute limit that can'tbe exceeded.  Only a privileged user may raise it.See also <b class="emphasis-bold"><a href="#unlimit">unlimit</a></b>.</p><h4 class="refsect2">Resource</h4><dl><dt><tt class="literal">cputime</tt></dt><dd>Maximum number of seconds the CPU can spend;can be abbreviated as <tt class="literal">cpu</tt></p></dd><dt><tt class="literal">filesize</tt></dt><dd>Maximum size of any one file</p></dd><dt><tt class="literal">datasize</tt></dt><dd>Maximum size of data (including stack)</p></dd><dt><tt class="literal">stacksize</tt></dt><dd>Maximum size of stack</p></dd><dt><tt class="literal">coredumpsize</tt></dt><dd>Maximum size of a core dump file</p></dd></dl><h4 class="refsect2">Limit</h4><p>A number followed by an optional character (a unit specifier).</p><table border="1" cellpadding="3"><tr><td>For <tt class="literal">cputime</tt>:</td><td><em class="emphasis">n</em><tt class="literal">h</tt> (for<em class="emphasis">n</em> hours),<em class="emphasis">n</em><tt class="literal">m</tt> (for <em class="emphasis">n</em>minutes), <em class="emphasis">mm</em><tt class="literal">:</tt><tt class="literal">ss</tt>(minutes and seconds).</td></tr><tr><td>For others:</td><td><em class="emphasis">n</em><tt class="literal">k</tt> (for<em class="emphasis">n</em> kilobytes, the default), <em class="emphasis">n</em><tt class="literal">m</tt> (for <em class="emphasis">n</em> megabytes).</td></tr></table><p></td></tr><tr><td valign="top"><a name="login">login</a></a></td><td><tt class="literal">login</tt> [<em class="replaceable"><tt>user</tt></em> | <tt class="literal">-p</tt> ]<p><a name="IXT-5-123062" />Replace <em class="emphasis">user</em>'s login shell with <tt class="literal">/bin/login</tt>.<tt class="literal">-p</tt> preserves environment variables.</p></td></tr><tr><td valign="top"><a name="logout">logout</a></a></td><td><tt class="literal">logout</tt><p><a name="IXT-5-123063" />Terminate the login shell.</p></td></tr><tr><td valign="top"><a name="nice">nice</a></a></td><td><tt class="literal">nice</tt> [<tt class="literal">&#177;</tt><em class="replaceable"><tt>n</em>] <em class="replaceable">command</tt></em><p><a name="IXT-5-123064" />Change the execution priority for <em class="emphasis">command</em>, or, ifnone is given, change priority for the current shell.(See also <b class="emphasis-bold"><a href="ch02_01.htm#nice">nice</a></b> in <a href="ch02_01.htm">Chapter 2</a>.)The priority range is -20 to 20, with a default of 4.The range is backwards from what you might expect:-20 gives the highest priority(fastest execution); 20 gives the lowest.</p><dl><dt><tt class="literal">+</tt><tt><em class="replaceable">n</em></tt></dt><dd>Add <em class="emphasis">n</em></tt> to the priority value (lower job priority).</p></dd><dt><tt class="literal">-</tt><tt><em class="replaceable">n</em></tt></dt><dd>Subtract <em class="emphasis">n</em></tt> from the priority value (raise job priority).Privileged users only.</p></dd></dl></td></tr><tr><td valign="top"><a name="nohup">nohup</a></a></td><td><tt class="literal">nohup</tt> [<em class="replaceable"><tt>command</tt></em>]<p><a name="IXT-5-123065" />&#8220;No hangup signals.&#8221;Do not terminate <em class="emphasis">command</em> after terminal line isclosed (i.e., when you hang up from a phone or log out).  Use without <em class="emphasis">command</em> in shellscripts to keep script frombeing terminated.(See also <b class="emphasis-bold"><a href="ch02_01.htm#nohup">nohup</a></b> in <a href="ch02_01.htm">Chapter 2</a>.)</p></td></tr><tr><td valign="top"><a name="notify">notify</a></a></td><td><tt class="literal">notify</tt> [<em class="replaceable"><tt>jobID</tt></em>]<p><a name="IXT-5-123066" />Report immediately when a background job finishes(instead of waiting for you to exit a long editing session,for example).  If no <em class="emphasis">jobID</em> is given, the current backgroundjob is assumed.</p></td></tr><tr><td valign="top"><a name="onintr">onintr</a></a></td><td><tt class="literal">onintr</tt> <em class="replaceable"><tt>label</tt></em><br><tt class="literal">onintr -</tt><br><tt class="literal">onintr</tt><p><a name="IXT-5-123067" />&#8220;On interrupt.&#8221;  Used in shell scripts to handle interrupt signals(similar to the Bourne shell's <tt class="literal">trap 2</tt> and <tt class="literal">trap "" 2</tt> commands).The first form is like a <tt class="literal">goto</tt> <em class="emphasis">label</em>.  The scriptbranches to <em class="emphasis">label</em><tt class="literal">:</tt> if it catches an interrupt signal (e.g., <tt class="literal">CTRL-C</tt>).The second form lets the script ignore interrupts.  This is usefulat the beginning of a script or before any code segment that needsto run unhindered (e.g., when moving files).The third form restores interrupt handling that was previously disabledwith <tt class="literal">onintr -</tt>.</p><h4 class="refsect2">Example</h4><blockquote><pre class="code">onintr cleanup     <i class="lineannotation">Go to &#8220;cleanup&#8221; on interrupt</i> . .                 <i class="lineannotation">Shell script commands</i> .cleanup:           <i class="lineannotation">Label for interrupts</i>  onintr -         <i class="lineannotation">Ignore additional interrupts</i>  rm -f $tmpfiles  <i class="lineannotation">Remove any files created</i>  exit 2           <i class="lineannotation">Exit with an error status</i></pre></blockquote></td></tr><tr><td valign="top"><a name="popd">popd</a></a></td><td><tt class="literal">popd</tt> [<tt class="literal">+</tt><em class="replaceable"><tt>n</tt></em>]<p><a name="IXT-5-123068" />Removethe current entry from the directory stackor remove the <em class="emphasis">n</em>th entry from the stack.  The currententry has number 0 and appears on the left.See also <b class="emphasis-bold"><a href="#dirs">dirs</a></b> and <b class="emphasis-bold"><a href="#pushd">pushd</a></b>.</p></td></tr><tr><td valign="top"><a name="pushd">pushd</a></a></td><td><p><tt class="literal">pushd</tt> <em class="replaceable"><tt>name</em></p><p><tt class="literal">pushd</tt> <tt class="literal">+</tt><em class="replaceable">n</tt></em></p><p><tt class="literal">pushd</tt></p><p><a name="IXT-5-123069" />The first form changes the working directory to <em class="emphasis">name</em> and adds itto the directory stack.  The second form rotates the <em class="emphasis">n</em>th entry to thebeginning, making it the working directory.  (Entry numbers begin at 0.)With no arguments, <tt class="literal">pushd</tt> switches the first two entriesand changes to the new current directory.  See also <b class="emphasis-bold"><a href="#dirs">dirs</a></b> and <b class="emphasis-bold"><a href="#popd">popd</a></b>.</a> <h4 class="refsect2">Examples</h4><blockquote><pre class="code">5% <tt class="userinput"><b>dirs</b></tt>/home/bob /usr6% <tt class="userinput"><b>pushd /etc</b></tt>             <i class="lineannotation">Add /etc to directory stack</i>/etc /home/bob /usr7% <tt class="userinput"><b>pushd +2</b></tt>               <i class="lineannotation">Switch to third directory</i>/usr /etc /home/bob8% <tt class="userinput"><b>pushd</b></tt>                  <i class="lineannotation">Switch top two directories</i>/etc /usr /home/bob9% <tt class="userinput"><b>popd</b></tt>                   <i class="lineannotation">Discard current entry; go to next</i>/usr /home/bob</pre></blockquote></td></tr><tr><td valign="top"><a name="rehash">rehash</a></a></td><td><tt class="literal">rehash</tt><p><a name="IXT-5-123070" />Recompute the hash table for the <tt class="literal">path</tt> variable.  Use <tt class="literal">rehash</tt> whenever a new command is created during the current session.This allows the shellto locate and execute the command.(If the new command resides in a directory not listed in <tt class="literal">path</tt>,add this directory to <tt class="literal">path</tt> before rehashing.)See also <b class="emphasis-bold"><a href="#unhash">unhash</a></b>.</p></td></tr><tr><td valign="top"><a name="repeat">repeat</a></a></td><td><p><tt class="literal">repeat</tt> <em class="replaceable"><tt>n command</tt></em></p><p><a name="IXT-5-123071" />Execute <em class="emphasis">n</em> instances of <em class="emphasis">command</em>.</p><h4 class="refsect2">Examples</h4><p>Generate a test file for a program by saving25 copies of <tt class="literal">/usr/dict/words</tt> in a file:</p><blockquote><pre class="code">% <tt class="userinput"><b>repeat 25 cat /usr/dict/words &gt; test_file</b></tt></pre></blockquote><p>Read 10 lines from the terminal and store in <tt class="literal">item_list</tt>:</p><blockquote><pre class="code">% <tt class="userinput"><b>repeat 10 line &gt; item_list</b></tt></pre></blockquote><p>Append50 boilerplate files to <tt class="literal">report</tt>:</p><blockquote><pre class="code">% <tt class="userinput"><b>repeat 50 cat template &gt;&gt; report</b></tt></pre></blockquote></td></tr><tr><td valign="top"><a name="set">set</a></a></td><td><tt class="literal">set</tt> <em class="replaceable"><tt>variable</em> <tt class="literal">=</tt> <em class="replaceable">value</em><br><tt class="literal">set</tt> <em class="replaceable">variable</em><tt class="literal">[</tt><em class="replaceable">n</em><tt class="literal">] =</tt> <em class="replaceable">value</tt></em><br><tt class="literal">set</tt><p><a name="IXT-5-123072" />Set <em class="emphasis">variable</em> to <em class="emphasis">value</em>, or, if multiple values are specified, set thevariable to the list of words in the value list.  If an index <em class="emphasis">n</em>is specified, set the <em class="emphasis">n</em>th word in the variable to <em class="emphasis">value</em>.(The variable must already contain at least that number of words.)With no arguments, display the names and values of all set variables.See also <a href="ch05_03.htm#unut-ch-5-sect-3.3">Section 5.3.3</a>  earlier in this chapter.</p><h4 class="refsect2">Examples</h4><blockquote><pre class="code">% <tt class="userinput"><b>set list=(yes no maybe)</b></tt>           <i class="lineannotation">Assign a word list</i>% <tt class="userinput"><b>set list[3]=maybe</b></tt>                 <i class="lineannotation">Assign an item in existing word list</i>% <tt class="userinput"><b>set quote="Make my day"</b></tt>           <i class="lineannotation">Assign a variable</i>% <tt class="userinput"><b>set x=5 y=10 history=100</b></tt>          <i class="lineannotation">Assign several variables</i>% <tt class="userinput"><b>set blank</b></tt>                         <i class="lineannotation">Assign a null value to blank</i> </pre></blockquote></td></tr><tr><td valign="top"><a name="setenv">setenv</a></a></td><td><tt class="literal">setenv</tt> [<em class="replaceable"><tt>name</em> [<em class="replaceable">value</tt></em>]]<p><a name="IXT-5-123073" />Assign a <em class="emphasis">value</em> to an environment variable <em class="emphasis">name</em>.By convention, <em class="emphasis">name</em> should be uppercase.<em class="emphasis">value</em> can be a single word or a quoted string.If no <em class="emphasis">value</em> is given, the null value is assigned.With no arguments, display the names and values of all environment variables.  <tt class="literal">setenv</tt> is not necessary for theUSER, TERM, and PATH variablesbecause they are automatically exportedfrom <tt class="literal">user</tt>, <tt class="literal">term</tt>, and <tt class="literal">path</tt>.See also <a href="ch05_03.htm#unut-ch-5-sect-3.5">Section 5.3.5</a>.</p></td></tr><tr><td valign="top"><a name="shift">shift</a></a></td><td><tt class="literal">shift</tt> [<em class="replaceable"><tt>variable</tt></em>]

⌨️ 快捷键说明

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