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

📄 ch02_01.htm

📁 unix基础教程
💻 HTM
📖 第 1 页 / 共 5 页
字号:
as a numeric hour (with optional minutes and modifiers)or as a keyword.  <em class="emphasis">date</em></tt> can be formed eitheras a month and date, as a day of the week, or as a special keyword.<em class="emphasis">increment</em></tt> is a positive integer followed by a keyword.See the following lists for details.</p><h4 class="refsect2">Options1</h4><dl><dt><tt class="literal">-c</tt></dt><dd>Use the C shell to execute the job.Solaris only.</p></dd><dt><tt class="literal">-f</tt> <tt><em class="replaceable">file</em></tt></dt><dd>Execute commands listed in <em class="emphasis">file</em></tt>.</p></dd><dt><tt class="literal">-k</tt></dt><dd>Use the Korn shell to execute the job.Solaris only.</p></dd><dt><tt class="literal">-m</tt></dt><dd>Send mail to user after job is completed.</p></dd><dt><tt class="literal">-q</tt> <tt><em class="replaceable">queuename</em></tt></dt><dd>Schedule the job in <em class="emphasis">queuename</em></tt>.Values for <em class="emphasis">queuename</em> are the lowercase letters<tt class="literal">a</tt> through <tt class="literal">z</tt>.Queue <tt class="literal">a</tt> is the default queue for <tt class="literal">at</tt> jobs.Queue <tt class="literal">b</tt> is the queue for <tt class="literal">batch</tt> jobs.Queue <tt class="literal">c</tt> is the queue for <tt class="literal">cron</tt> jobs.Solaris only.</p></dd><dt><tt class="literal">-s</tt></dt><dd>Use the Bourne shell to execute the job.Solaris only.</p></dd><dt><tt class="literal">-t</tt> <tt><em class="replaceable">time</em></tt></dt><dd>Run the job at <em class="emphasis">time</em></tt>, which is in the same format asallowed by <tt class="literal">touch</tt>.Solaris only.</p></dd></dl><h4 class="refsect2">Options2</h4><dl><dt><tt class="literal">-l</tt></dt><dd>Report all jobs that are scheduled for the invoking user or,if <em class="emphasis">jobs</em></tt> are specified, report only for those.See also <b class="emphasis-bold"><a href="#atq">atq</a></b>.</p></dd><dt><tt class="literal">-r</tt></dt><dd>Remove specified <em class="emphasis">jobs</em></tt> that were previously scheduled.  To remove a job,you must be a privileged user or the owner of the job.  Use <tt class="literal">-l</tt> firstto see the list of scheduled jobs.  See also <b class="emphasis-bold"><a href="#atrm">atrm</a></b>.</p></dd></dl><h4 class="refsect2">Time</h4><dl><dt><i><tt><em class="replaceable"><tt>hh</em></tt><tt class="literal">:</tt><tt><em class="replaceable">mm</em></tt> [<tt><em class="replaceable">modifiers</tt></em></tt>]</i></dt><dd>Hours can have one or two digits (a 24-hour clock is assumed by default);optional minutes can be given as one or two digits;the colon can be omitted if the format is <em class="emphasis">h</em></tt>, <em class="emphasis">hh</em></tt>, or <em class="emphasis">hhmm</em></tt>;e.g., valid times are 5, 5:30, 0530, 19:45.If modifier <tt class="literal">am</tt> or <tt class="literal">pm</tt> is added, <em class="emphasis">time</em></tt> is based ona 12-hour clock.  If the keyword <tt class="literal">zulu</tt>is added, times correspond to Greenwich Mean Time (UTC).</p></dd><dt><tt class="literal">midnight </tt>| <tt class="literal">noon </tt>| <tt class="literal">now</tt></dt><dd>Use any one of these keywords in place of a numeric time.<tt class="literal">now</tt> must be followed by an <em class="emphasis">increment</em>.</p></dd></dl><h4 class="refsect2">Date</h4><dl><dt><i><tt><em class="replaceable"><tt>month num</em></tt>[<tt class="literal">,</tt> <tt><em class="replaceable">year</em></tt>]</i></dt><dd><em class="emphasis">month</em></tt> is one of the 12 months, spelled out or abbreviated totheir first three letters; <em class="emphasis">num</tt></em></tt> is the calendar day of the month;<em class="emphasis">year</em></tt> is the four-digit year.  If the given <em class="emphasis">month</em></tt> occurs beforethe current month, <tt class="literal">at</tt> schedules that month next year.</p></dd><dt><i><tt><em class="replaceable"><tt>day</tt></em></tt></i></dt><dd>One of the seven days of the week, spelled out or abbreviated to theirfirst three letters.</p></dd><dt><tt class="literal">today </tt>| <tt class="literal">tomorrow</tt></dt><dd>Indicate the current day or the next day.  If <em class="emphasis">date</em></tt> is omitted,<tt class="literal">at</tt> schedules <tt class="literal">today</tt> when the specified <em class="emphasis">time</em></tt> occurslater than the current time; otherwise, <tt class="literal">at</tt> schedules <tt class="literal">tomorrow</tt>.</p></dd></dl><h4 class="refsect2">Increment</h4><p>Supply a numeric increment if you want to specify an execution time or day<em class="emphasis">relative</em></tt> to the current time.  The number should precede any ofthe keywords <tt class="literal">minute</tt>, <tt class="literal">hour</tt>, <tt class="literal">day</tt>,<tt class="literal">week</tt>, <tt class="literal">month</tt>, or<tt class="literal">year</tt> (or their plural forms).The keyword <tt class="literal">next</tt> can be usedas a synonym of <tt class="literal">+ 1</tt>.</p><h4 class="refsect2">Examples</h4><p>Note that the first two commands are equivalent:</p><blockquote><pre class="code"><tt class="userinput"><b>at 1945 pm December 9at 7:45pm Dec 9at 3 am Saturdayat now + 5 hoursat noon next day</b></tt></pre></blockquote></td></tr><tr><td valign="top"><a name="atq">atq</a></a></td><td><tt class="literal">atq</tt> [<tt><em class="replaceable"><tt>options</em></tt>] [<tt><em class="replaceable">users</tt></em></tt>]<p><a name="IXT-2-121822" /><a name="IXT-2-121823" />List jobs created by the <tt class="literal">at</tt> command that are still in the queue.Normally, jobs are sorted by the order in which they execute.Specify the <em class="emphasis">users</em></tt> whose jobs you want to check.If no <em class="emphasis">users</em></tt> are specified, the default is to display all jobsif you're a privileged user; otherwise, only your jobs are displayed.</p><h4 class="refsect2">Options</h4><dl><dt><tt class="literal">-c</tt></dt><dd>Sort the queue according to the time the <tt class="literal">at</tt> command was given.</p></dd><dt><tt class="literal">-n</tt></dt><dd>Print only the total number of jobs in queue.</p></dd></dl></td></tr><tr><td valign="top"><a name="atrm">atrm</a></a></td><td><tt class="literal">atrm</tt> [<tt><em class="replaceable"><tt>options</em></tt>] [<tt><em class="replaceable">users </em></tt>| <tt><em class="replaceable">jobIDs</tt></em></tt>]<p><a name="IXT-2-121824" /><a name="IXT-2-121825" />Remove jobs queued with <tt class="literal">at</tt> that match the specified <em class="emphasis">jobIDs</em></tt>.A privileged user may also specify the <em class="emphasis">users</em></tt> whose jobs are to beremoved.</p><h4 class="refsect2">Options</h4><dl><dt><tt class="literal">-a</tt></dt><dd>Remove all jobs belonging to the current user.(A privileged user can remove <em class="emphasis">all</em> jobs.)</p></dd><dt><tt class="literal">-f</tt></dt><dd>Remove jobs unconditionally,suppressing all information regarding removal.</p></dd><dt><tt class="literal">-i</tt></dt><dd>Prompt for <tt class="literal">y</tt> (remove the job) or <tt class="literal">n</tt> (do not remove).</p></dd></dl></td></tr><tr><td valign="top"><a name="awk">awk</a></a></td><td><tt class="literal">awk</tt> [<em class="replaceable"><tt>options</em>] [<em class="replaceable">program</em>] [<em class="replaceable">var</em><tt class="literal">=</tt><em class="replaceable">value</em> ...] [<em class="replaceable">files</tt></em>]<p><a name="IXT-2-121826" /><a name="IXT-2-121827" /><a name="IXT-2-121828" /><a name="IXT-2-121829" />Use the pattern-matching <em class="emphasis">program</em> to process the specified <em class="emphasis">files</em>.<tt class="literal">awk</tt> has been replaced by <tt class="literal">nawk</tt> (there's also a GNU version called<tt class="literal">gawk</tt>).<em class="emphasis">program</em> instructions have the general form:</p><blockquote><pre class="code"><em class="replaceable"><tt>pattern</em> { <em class="replaceable">procedure</tt></em> }</pre></blockquote><p><em class="emphasis">pattern</em> and <em class="emphasis">procedure</em> are optional.When specified on the command line, <em class="emphasis">program</em> must beenclosed in single quotes to prevent the shell from interpretingits special symbols.Any variables specified in <em class="emphasis">program</em> can be assigned aninitial value by using command-line arguments of the form <em class="replaceable"><tt>var</em><tt class="literal">=</tt><em class="replaceable">value</tt></em>.See <a href="ch11_01.htm">Chapter 11</a>,for more information (including examples) on <tt class="literal">awk</tt>.</p><h4 class="refsect2">Options</h4><dl><dt><tt class="literal">-f</tt>&#160;<tt><em class="replaceable">file</em></tt></dt><dd>Use program instructions contained in <em class="emphasis">file</em></tt>, insteadof specifying <em class="emphasis">program</em></tt> on the command line.</p></dd><dt><tt class="literal">-F</tt><tt><em class="replaceable">c</em></tt></dt><dd>Treat input <em class="emphasis">file</em></tt> as fields separated by character<em class="emphasis">c</em>.By default, input fields are separated by runs of spaces and/or tabs.</p></dd></dl></td></tr><tr><td valign="top"><a name="banner">banner</a></a></td><td><tt class="literal">banner</tt> <em class="replaceable"><tt>characters</tt></em><p><a name="IXT-2-121830" /><a name="IXT-2-121831" />Print <em class="emphasis">characters</em> as a poster on the standard output.Each word supplied must contain ten characters or less.</p></td></tr><tr><td valign="top"><a name="basename">basename</a></a></td><td><tt class="literal">basename</tt> <em class="replaceable"><tt>pathname</em> [<em class="replaceable">suffix</tt></em>]<p><a name="IXT-2-121832" /><a name="IXT-2-121833" /><a name="IXT-2-121834" />Given a <em class="emphasis">pathname</em>, strip the path prefix andleave just the filename, which is printed on standard output.If specified, a filename <em class="emphasis">suffix</em> (e.g., <tt class="literal">.c</tt>)is removed also.  <tt class="literal">basename</tt> is typically invoked viacommand substitution (<tt class="literal">&#8216;</tt>...<tt class="literal">&#8216;</tt>) togenerate a filename.  See also <b class="emphasis-bold"><a href="#dirname">dirname</a></b>.</p><p>The Solaris version of <tt class="literal">basename</tt> allows the suffix to bea pattern of the form accepted by <tt class="literal">expr</tt>.See the entry for <b class="emphasis-bold"><a href="#expr">expr</a></b> for more details.</p><h4 class="refsect2">Example</h4><p>Given the following fragment from a Bourne shell script:</p><blockquote><pre class="code">ofile=output_filemyname="`basename $0`"echo "$myname: QUITTING: can't open $ofile" 1&gt;&amp;2exit 1</pre></blockquote><p>If the script is called <tt class="literal">do_it</tt>, the following message wouldbe printed on standard error:</p><blockquote><pre class="code">do_it: QUITTING: can't open output_file</pre></blockquote></td></tr><tr><td valign="top"><a name="batch">batch</a></a></td><td><tt class="literal">batch</tt><p><a name="IXT-2-121835" /><a name="IXT-2-121836" />Execute commands entered on standard input.  End with <em class="emphasis">EOF</em>.Unlike <tt class="literal">at</tt>, which executes commands at a specific time,<tt class="literal">batch</tt> executes commands one after another (waiting for each oneto complete).  This avoids the potentially high system load caused by runningseveral background jobs at once.  See also <b class="emphasis-bold"><a href="#at">at</a></b>.</p><p><tt class="literal">batch</tt> is equivalent to <tt class="literal">at -q b -m now</tt>.</p><h4 class="refsect2">Example</h4><blockquote><pre class="code">$ <tt class="userinput"><b>batch</b></tt><tt class="userinput"><b>sort</b></tt> <em class="replaceable"><tt>in</em> <tt class="userinput"><b>&gt;</b></tt> <em class="replaceable">out</tt></em><tt class="userinput"><b>troff -ms</b></tt> <em class="replaceable"><tt>bigfile</em> <tt class="userinput"><b>&gt;</b></tt> <em class="replaceable">bigfile.ps</tt></em><i class="lineannotation">EOF</i></pre></blockquote></td></tr><tr><td valign="top"><a name="bc">bc</a></a></td><td><tt class="literal">bc</tt> [<em class="replaceable"><tt>options</em>] [<em class="replaceable">files</tt></em>]<p><a name="IXT-2-121837" /><a name="IXT-2-121838" />Interactively perform arbitrary-precision arithmetic or convert numbersfrom one base to another.  Input can be taken from<em class="emphasis">files</em> or read from the standard input.  To exit, type<tt class="literal">quit</tt> or <em class="emphasis">EOF</em>.</p><h4 class="refsect2">Options</h4><dl><dt><tt class="literal">-c</tt></dt><dd>Do not invoke <tt class="literal">dc</tt>; compile only.(Since <tt class="literal">bc</tt> is a preprocessor for <tt class="literal">dc</tt>,<tt class="literal">bc</tt> normally invokes <tt class="literal">dc</tt>.)</p></dd><dt><tt class="literal">-l</tt></dt><dd>Make available functions from the math library.</p></dd></dl><p><tt class="literal">bc</tt> is a language (and compiler) whose syntax resembles that of C.<tt class="literal">bc</tt> consists of identifiers, keywords, and symbols, whichare briefly described here.  Examples follow at the end.</p><h4 class="refsect2">Identifiers</h4><p>An identifier is a single character, consisting of the lowercaseletters a&#8211;z.Identifiers are used as names for variables, arrays, and functions.Within the same program you may name a variable, an array,and a function using the same letter.  The following identifiers wouldnot conflict:</p><table border="1" cellpadding="3"><tr><td><tt class="literal">x</tt></td><td><p>Variable <tt class="literal">x</tt>.</p></td></tr><tr><td><tt class="literal">x[</tt><em class="replaceable"><tt>i</em><tt class="literal">]</tt></td><td><p>Element <em class="emphasis">i</tt></em> of array <tt class="literal">x</tt>.<em class="emphasis">i</em> can range from 0 to 2047and can also be an expression.</p></td></tr><tr><td><tt class="literal">x(y,z)</tt></td><td><p>Call function <tt class="literal">x</tt> with parameters <tt class="literal">y</tt> and <tt class="literal">z</tt>.</p></td></tr>

⌨️ 快捷键说明

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