563 lines
22 KiB
HTML
563 lines
22 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<html>
|
|
<head>
|
|
<meta name="generator" content="HTML Tidy, see www.w3.org">
|
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
|
<link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group's rhtm tool v1.2.1 -->
|
|
<!-- Copyright (c) 2001 The Open Group, All Rights Reserved -->
|
|
<title>set</title>
|
|
</head>
|
|
<body bgcolor="white">
|
|
<script type="text/javascript" language="JavaScript" src="../jscript/codes.js">
|
|
</script>
|
|
|
|
<basefont size="3"> <a name="set"></a> <a name="tag_04_127"></a><!-- set -->
|
|
<!--header start-->
|
|
<center><font size="2">The Open Group Base Specifications Issue 6<br>
|
|
IEEE Std 1003.1-2001<br>
|
|
Copyright © 2001 The IEEE and The Open Group, All Rights reserved.</font></center>
|
|
|
|
<!--header end-->
|
|
<hr size="2" noshade>
|
|
<h4><a name="tag_04_127_01"></a>NAME</h4>
|
|
|
|
<blockquote>set - set or unset options and positional parameters</blockquote>
|
|
|
|
<h4><a name="tag_04_127_02"></a>SYNOPSIS</h4>
|
|
|
|
<blockquote class="synopsis">
|
|
<p><code><tt><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> set</tt> <b>[</b><tt>-abCefmnuvx</tt><b>]<img src=
|
|
"../images/opt-start.gif" border="0">[</b><tt>-h</tt><b>]<img src="../images/opt-end.gif" border="0">[</b><tt>-o</tt>
|
|
<i>option</i><b>][</b><i>argument</i><tt>...</tt><b>]</b><tt><br>
|
|
<br>
|
|
<sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> set</tt> <b>[</b><tt>+abCefmnuvx</tt><b>]<img src=
|
|
"../images/opt-start.gif" border="0">[</b><tt>+h</tt><b>]<img src="../images/opt-end.gif" border="0">[</b><tt>+o</tt>
|
|
<i>option</i><b>][</b><i>argument</i><b>...]</b><tt><br>
|
|
<br>
|
|
set --</tt> <b>[</b><i>argument</i><tt>...</tt><b>]</b><tt><br>
|
|
<br>
|
|
set -o<br>
|
|
<br>
|
|
set +o<br>
|
|
</tt></code></p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_127_03"></a>DESCRIPTION</h4>
|
|
|
|
<blockquote>
|
|
<p>If no <i>option</i>s or <i>argument</i>s are specified, <i>set</i> shall write the names and values of all shell variables in
|
|
the collation sequence of the current locale. Each <i>name</i> shall start on a separate line, using the format:</p>
|
|
|
|
<pre>
|
|
<tt>"%s=%s\n", <</tt><i>name</i><tt>>, <</tt><i>value</i><tt>>
|
|
</tt>
|
|
</pre>
|
|
|
|
<p>The <i>value</i> string shall be written with appropriate quoting; see the description of shell quoting in <a href=
|
|
"xcu_chap02.html#tag_02_02"><i>Quoting</i></a> . The output shall be suitable for reinput to the shell, setting or resetting, as
|
|
far as possible, the variables that are currently set; read-only variables cannot be reset.</p>
|
|
|
|
<p>When options are specified, they shall set or unset attributes of the shell, as described below. When <i>argument</i>s are
|
|
specified, they cause positional parameters to be set or unset, as described below. Setting or unsetting attributes and positional
|
|
parameters are not necessarily related actions, but they can be combined in a single invocation of <i>set</i>.</p>
|
|
|
|
<p>The <i>set</i> special built-in shall support the Base Definitions volume of IEEE Std 1003.1-2001, <a href=
|
|
"../basedefs/xbd_chap12.html#tag_12_02">Section 12.2, Utility Syntax Guidelines</a> except that options can be specified with
|
|
either a leading hyphen (meaning enable the option) or plus sign (meaning disable it) unless otherwise specified.</p>
|
|
|
|
<p>Implementations shall support the options in the following list in both their hyphen and plus-sign forms. These options can also
|
|
be specified as options to <a href="../utilities/sh.html"><i>sh</i></a>.</p>
|
|
|
|
<dl compact>
|
|
<dt><b>-a</b></dt>
|
|
|
|
<dd>When this option is on, the <i>export</i> attribute shall be set for each variable to which an assignment is performed; see the
|
|
Base Definitions volume of IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap04.html#tag_04_21">Section 4.21, Variable
|
|
Assignment</a>. If the assignment precedes a utility name in a command, the <i>export</i> attribute shall not persist in the
|
|
current execution environment after the utility completes, with the exception that preceding one of the special built-in utilities
|
|
causes the <i>export</i> attribute to persist after the built-in has completed. If the assignment does not precede a utility name
|
|
in the command, or if the assignment is a result of the operation of the <a href="../utilities/getopts.html"><i>getopts</i></a> or
|
|
<a href="../utilities/read.html"><i>read</i></a> utilities, the <i>export</i> attribute shall persist until the variable is
|
|
unset.</dd>
|
|
|
|
<dt><b>-b</b></dt>
|
|
|
|
<dd>This option shall be supported if the implementation supports the User Portability Utilities option. It shall cause the shell
|
|
to notify the user asynchronously of background job completions. The following message is written to standard error:
|
|
|
|
<pre>
|
|
<tt>"[%d]%c %s%s\n", <</tt><i>job-number</i><tt>>, <</tt><i>current</i><tt>>, <status>, <job-name>
|
|
</tt>
|
|
</pre>
|
|
|
|
<p>where the fields shall be as follows:</p>
|
|
|
|
<dl compact>
|
|
<dt><<i>current</i>></dt>
|
|
|
|
<dd>The character <tt>'+'</tt> identifies the job that would be used as a default for the <a href=
|
|
"../utilities/fg.html"><i>fg</i></a> or <a href="../utilities/bg.html"><i>bg</i></a> utilities; this job can also be specified
|
|
using the <i>job_id</i> <tt>"%+"</tt> or <tt>"%%"</tt> . The character <tt>'-'</tt> identifies the job that would become the
|
|
default if the current default job were to exit; this job can also be specified using the <i>job_id</i> <tt>"%-"</tt> . For other
|
|
jobs, this field is a <space>. At most one job can be identified with <tt>'+'</tt> and at most one job can be identified with
|
|
<tt>'-'</tt> . If there is any suspended job, then the current job shall be a suspended job. If there are at least two suspended
|
|
jobs, then the previous job also shall be a suspended job.</dd>
|
|
|
|
<dt><<i>job-number</i>></dt>
|
|
|
|
<dd>A number that can be used to identify the process group to the <a href="../utilities/wait.html"><i>wait</i></a>, <a href=
|
|
"../utilities/fg.html"><i>fg</i></a>, <a href="../utilities/bg.html"><i>bg</i></a>, and <a href=
|
|
"../utilities/kill.html"><i>kill</i></a> utilities. Using these utilities, the job can be identified by prefixing the job number
|
|
with <tt>'%'</tt> .</dd>
|
|
|
|
<dt><<i>status</i>></dt>
|
|
|
|
<dd>Unspecified.</dd>
|
|
|
|
<dt><<i>job-name</i>></dt>
|
|
|
|
<dd>Unspecified.</dd>
|
|
</dl>
|
|
|
|
<p>When the shell notifies the user a job has been completed, it may remove the job's process ID from the list of those known in
|
|
the current shell execution environment; see <a href="xcu_chap02.html#tag_02_09_03_02"><i>Asynchronous Lists</i></a> . Asynchronous
|
|
notification shall not be enabled by default.</p>
|
|
</dd>
|
|
|
|
<dt><b>-C</b></dt>
|
|
|
|
<dd>(Uppercase C.) Prevent existing files from being overwritten by the shell's <tt>'>'</tt> redirection operator (see <a href=
|
|
"xcu_chap02.html#tag_02_07_02"><i>Redirecting Output</i></a> ); the <tt>">|"</tt> redirection operator shall override this
|
|
<i>noclobber</i> option for an individual file.</dd>
|
|
|
|
<dt><b>-e</b></dt>
|
|
|
|
<dd>When this option is on, if a simple command fails for any of the reasons listed in <a href=
|
|
"xcu_chap02.html#tag_02_08_01"><i>Consequences of Shell Errors</i></a> or returns an exit status value >0, and is not part of
|
|
the compound list following a <b>while</b>, <b>until</b>, or <b>if</b> keyword, and is not a part of an AND or OR list, and is not
|
|
a pipeline preceded by the <b>!</b> reserved word, then the shell shall immediately exit.</dd>
|
|
|
|
<dt><b>-f</b></dt>
|
|
|
|
<dd>The shell shall disable pathname expansion.</dd>
|
|
|
|
<dt><b>-h</b></dt>
|
|
|
|
<dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
|
|
Locate and remember utilities invoked by functions as those functions are defined (the utilities are normally located when the
|
|
function is executed). <img src="../images/opt-end.gif" alt="[Option End]" border="0"></dd>
|
|
|
|
<dt><b>-m</b></dt>
|
|
|
|
<dd>This option shall be supported if the implementation supports the User Portability Utilities option. All jobs shall be run in
|
|
their own process groups. Immediately before the shell issues a prompt after completion of the background job, a message reporting
|
|
the exit status of the background job shall be written to standard error. If a foreground job stops, the shell shall write a
|
|
message to standard error to that effect, formatted as described by the <a href="../utilities/jobs.html"><i>jobs</i></a> utility.
|
|
In addition, if a job changes status other than exiting (for example, if it stops for input or output or is stopped by a SIGSTOP
|
|
signal), the shell shall write a similar message immediately prior to writing the next prompt. This option is enabled by default
|
|
for interactive shells.</dd>
|
|
|
|
<dt><b>-n</b></dt>
|
|
|
|
<dd>The shell shall read commands but does not execute them; this can be used to check for shell script syntax errors. An
|
|
interactive shell may ignore this option.</dd>
|
|
|
|
<dt><b>-o</b></dt>
|
|
|
|
<dd>Write the current settings of the options to standard output in an unspecified format.</dd>
|
|
|
|
<dt><b>+o</b></dt>
|
|
|
|
<dd>Write the current option settings to standard output in a format that is suitable for reinput to the shell as commands that
|
|
achieve the same options settings.</dd>
|
|
|
|
<dt><b>-o </b> <i>option</i></dt>
|
|
|
|
<dd><br>
|
|
This option is supported if the system supports the User Portability Utilities option. It shall set various options, many of which
|
|
shall be equivalent to the single option letters. The following values of <i>option</i> shall be supported:
|
|
|
|
<dl compact>
|
|
<dt><i>allexport</i></dt>
|
|
|
|
<dd>Equivalent to <b>-a</b>.</dd>
|
|
|
|
<dt><i>errexit</i></dt>
|
|
|
|
<dd>Equivalent to <b>-e</b>.</dd>
|
|
|
|
<dt><i>ignoreeof</i></dt>
|
|
|
|
<dd>Prevent an interactive shell from exiting on end-of-file. This setting prevents accidental logouts when <control>-D is
|
|
entered. A user shall explicitly <a href="../utilities/exit.html"><i>exit</i></a> to leave the interactive shell.</dd>
|
|
|
|
<dt><i>monitor</i></dt>
|
|
|
|
<dd>Equivalent to <b>-m</b>. This option is supported if the system supports the User Portability Utilities option.</dd>
|
|
|
|
<dt><i>noclobber</i></dt>
|
|
|
|
<dd>Equivalent to <b>-C</b> (uppercase C).</dd>
|
|
|
|
<dt><i>noglob</i></dt>
|
|
|
|
<dd>Equivalent to <b>-f</b>.</dd>
|
|
|
|
<dt><i>noexec</i></dt>
|
|
|
|
<dd>Equivalent to <b>-n</b>.</dd>
|
|
|
|
<dt><i>nolog</i></dt>
|
|
|
|
<dd>Prevent the entry of function definitions into the command history; see <a href="../utilities/sh.html#tag_04_128_13_01"><i>Command History List</i></a>
|
|
.</dd>
|
|
|
|
<dt><i>notify</i></dt>
|
|
|
|
<dd>Equivalent to <b>-b</b>.</dd>
|
|
|
|
<dt><i>nounset</i></dt>
|
|
|
|
<dd>Equivalent to <b>-u</b>.</dd>
|
|
|
|
<dt><i>verbose</i></dt>
|
|
|
|
<dd>Equivalent to <b>-v</b>.</dd>
|
|
|
|
<dt><i>vi</i></dt>
|
|
|
|
<dd>Allow shell command line editing using the built-in <a href="../utilities/vi.html"><i>vi</i></a> editor. Enabling <a href=
|
|
"../utilities/vi.html"><i>vi</i></a> mode shall disable any other command line editing mode provided as an implementation
|
|
extension.
|
|
|
|
<p>It need not be possible to set <a href="../utilities/vi.html"><i>vi</i></a> mode on for certain block-mode terminals.</p>
|
|
</dd>
|
|
|
|
<dt><i>xtrace</i></dt>
|
|
|
|
<dd>Equivalent to <b>-x</b>.</dd>
|
|
</dl>
|
|
</dd>
|
|
|
|
<dt><b>-u</b></dt>
|
|
|
|
<dd>The shell shall write a message to standard error when it tries to expand a variable that is not set and immediately exit. An
|
|
interactive shell shall not exit.</dd>
|
|
|
|
<dt><b>-v</b></dt>
|
|
|
|
<dd>The shell shall write its input to standard error as it is read.</dd>
|
|
|
|
<dt><b>-x</b></dt>
|
|
|
|
<dd>The shell shall write to standard error a trace for each command after it expands the command and before it executes it. It is
|
|
unspecified whether the command that turns tracing off is traced.</dd>
|
|
</dl>
|
|
|
|
<p>The default for all these options shall be off (unset) unless stated otherwise in the description of the option or unless the
|
|
shell was invoked with them on; see <a href="../utilities/sh.html"><i>sh</i></a>.</p>
|
|
|
|
<p>The remaining arguments shall be assigned in order to the positional parameters. The special parameter <tt>'#'</tt> shall be set
|
|
to reflect the number of positional parameters. All positional parameters shall be unset before any new values are assigned.</p>
|
|
|
|
<p>The special argument <tt>"--"</tt> immediately following the <i>set</i> command name can be used to delimit the arguments if the
|
|
first argument begins with <tt>'+'</tt> or <tt>'-'</tt> , or to prevent inadvertent listing of all shell variables when there are
|
|
no arguments. The command <i>set</i> <b>--</b> without <i>argument</i> shall unset all positional parameters and set the special
|
|
parameter <tt>'#'</tt> to zero.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_127_04"></a>OPTIONS</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_127_05"></a>OPERANDS</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_127_06"></a>STDIN</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_127_07"></a>INPUT FILES</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_127_08"></a>ENVIRONMENT VARIABLES</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_127_09"></a>ASYNCHRONOUS EVENTS</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_127_10"></a>STDOUT</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_127_11"></a>STDERR</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_127_12"></a>OUTPUT FILES</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_127_13"></a>EXTENDED DESCRIPTION</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_127_14"></a>EXIT STATUS</h4>
|
|
|
|
<blockquote>
|
|
<p>Zero.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_127_15"></a>CONSEQUENCES OF ERRORS</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<hr>
|
|
<div class="box"><em>The following sections are informative.</em></div>
|
|
|
|
<h4><a name="tag_04_127_16"></a>APPLICATION USAGE</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_127_17"></a>EXAMPLES</h4>
|
|
|
|
<blockquote>
|
|
<p>Write out all variables and their values:</p>
|
|
|
|
<pre>
|
|
<tt>set
|
|
</tt>
|
|
</pre>
|
|
|
|
<p>Set $1, $2, and $3 and set <tt>"$#"</tt> to 3:</p>
|
|
|
|
<pre>
|
|
<tt>set c a b
|
|
</tt>
|
|
</pre>
|
|
|
|
<p>Turn on the <b>-x</b> and <b>-v</b> options:</p>
|
|
|
|
<pre>
|
|
<tt>set -xv
|
|
</tt>
|
|
</pre>
|
|
|
|
<p>Unset all positional parameters:</p>
|
|
|
|
<pre>
|
|
<tt>set --
|
|
</tt>
|
|
</pre>
|
|
|
|
<p>Set $1 to the value of <i>x</i>, even if it begins with <tt>'-'</tt> or <tt>'+'</tt> :</p>
|
|
|
|
<pre>
|
|
<tt>set -- "$x"
|
|
</tt>
|
|
</pre>
|
|
|
|
<p>Set the positional parameters to the expansion of <i>x</i>, even if <i>x</i> expands with a leading <tt>'-'</tt> or <tt>'+'</tt>
|
|
:</p>
|
|
|
|
<pre>
|
|
<tt>set -- $x
|
|
</tt>
|
|
</pre>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_127_18"></a>RATIONALE</h4>
|
|
|
|
<blockquote>
|
|
<p>The <i>set</i> -- form is listed specifically in the SYNOPSIS even though this usage is implied by the Utility Syntax
|
|
Guidelines. The explanation of this feature removes any ambiguity about whether the <i>set</i> -- form might be misinterpreted as
|
|
being equivalent to <i>set</i> without any options or arguments. The functionality of this form has been adopted from the
|
|
KornShell. In System V, <i>set</i> -- only unsets parameters if there is at least one argument; the only way to unset all
|
|
parameters is to use <a href="../utilities/shift.html"><i>shift</i></a>. Using the KornShell version should not affect System V
|
|
scripts because there should be no reason to issue it without arguments deliberately; if it were issued as, for example:</p>
|
|
|
|
<pre>
|
|
<tt>set -- "$@"
|
|
</tt>
|
|
</pre>
|
|
|
|
<p>and there were in fact no arguments resulting from <tt>"$@"</tt> , unsetting the parameters would have no result.</p>
|
|
|
|
<p>The <i>set</i> + form in early proposals was omitted as being an unnecessary duplication of <i>set</i> alone and not widespread
|
|
historical practice.</p>
|
|
|
|
<p>The <i>noclobber</i> option was changed to allow <i>set</i> <b>-C</b> as well as the <i>set</i> <b>-o</b> <i>noclobber</i>
|
|
option. The single-letter version was added so that the historical <tt>"$-"</tt> paradigm would not be broken; see <a href=
|
|
"xcu_chap02.html#tag_02_05_02"><i>Special Parameters</i></a> .</p>
|
|
|
|
<p>The <b>-h</b> flag is related to command name hashing and is only required on XSI-conformant systems.</p>
|
|
|
|
<p>The following <i>set</i> flags were omitted intentionally with the following rationale:</p>
|
|
|
|
<dl compact>
|
|
<dt><b>-k</b></dt>
|
|
|
|
<dd>The <b>-k</b> flag was originally added by the author of the Bourne shell to make it easier for users of pre-release versions
|
|
of the shell. In early versions of the Bourne shell the construct <i>set</i> <i>name</i>= <i>value</i> had to be used to assign
|
|
values to shell variables. The problem with <b>-k</b> is that the behavior affects parsing, virtually precluding writing any
|
|
compilers. To explain the behavior of <b>-k</b>, it is necessary to describe the parsing algorithm, which is
|
|
implementation-defined. For example:
|
|
|
|
<pre>
|
|
<tt>set -k; echo</tt> <i>name</i><tt>=</tt><i>value</i>
|
|
</pre>
|
|
|
|
<p>and:</p>
|
|
|
|
<pre>
|
|
<tt>set -k
|
|
echo</tt> <i>name</i><tt>=</tt><i>value</i>
|
|
</pre>
|
|
|
|
<p>behave differently. The interaction with functions is even more complex. What is more, the <b>-k</b> flag is never needed, since
|
|
the command line could have been reordered.</p>
|
|
</dd>
|
|
|
|
<dt><b>-t</b></dt>
|
|
|
|
<dd>The <b>-t</b> flag is hard to specify and almost never used. The only known use could be done with here-documents. Moreover,
|
|
the behavior with <i>ksh</i> and <a href="../utilities/sh.html"><i>sh</i></a> differs. The
|
|
reference page says that it exits after reading and executing one command. What is one command? If the input is <i>date</i>;
|
|
<i>date</i>, <a href="../utilities/sh.html"><i>sh</i></a> executes both <a href="../utilities/date.html"><i>date</i></a> commands
|
|
while <i>ksh</i> does only the first.</dd>
|
|
</dl>
|
|
|
|
<p>Consideration was given to rewriting <i>set</i> to simplify its confusing syntax. A specific suggestion was that the <a href=
|
|
"../utilities/unset.html"><i>unset</i></a> utility should be used to unset options instead of using the non- <a href=
|
|
"../functions/getopt.html"><i>getopt</i>()</a> -able + <i>option</i> syntax. However, the conclusion was reached that the
|
|
historical practice of using + <i>option</i> was satisfactory and that there was no compelling reason to modify such widespread
|
|
historical practice.</p>
|
|
|
|
<p>The <b>-o</b> option was adopted from the KornShell to address user needs. In addition to its generally friendly interface,
|
|
<b>-o</b> is needed to provide the <a href="../utilities/vi.html"><i>vi</i></a> command line editing mode, for which historical
|
|
practice yields no single-letter option name. (Although it might have been possible to invent such a letter, it was recognized that
|
|
other editing modes would be developed and <b>-o</b> provides ample name space for describing such extensions.)</p>
|
|
|
|
<p>Historical implementations are inconsistent in the format used for <b>-o</b> option status reporting. The <b>+o</b> format
|
|
without an option-argument was added to allow portable access to the options that can be saved and then later restored using, for
|
|
instance, a dot script.</p>
|
|
|
|
<p>Historically, <a href="../utilities/sh.html"><i>sh</i></a> did trace the command <i>set</i> <b>+x</b>, but
|
|
<i>ksh</i> did not.</p>
|
|
|
|
<p>The <i>ignoreeof</i> setting prevents accidental logouts when the end-of-file character (typically <control>-D) is
|
|
entered. A user shall explicitly <a href="../utilities/exit.html"><i>exit</i></a> to leave the interactive shell.</p>
|
|
|
|
<p>The <i>set</i> <b>-m</b> option was added to apply only to the UPE because it applies primarily to interactive use, not shell
|
|
script applications.</p>
|
|
|
|
<p>The ability to do asynchronous notification became available in the 1988 version of the KornShell. To have it occur, the user
|
|
had to issue the command:</p>
|
|
|
|
<pre>
|
|
<tt>trap "jobs -n" CLD
|
|
</tt>
|
|
</pre>
|
|
|
|
<p>The C shell provides two different levels of an asynchronous notification capability. The environment variable <i>notify</i> is
|
|
analogous to what is done in <i>set</i> <b>-b</b> or <i>set</i> <b>-o</b> <i>notify</i>. When set, it notifies the user immediately
|
|
of background job completions. When unset, this capability is turned off.</p>
|
|
|
|
<p>The other notification ability comes through the built-in utility <i>notify</i>. The
|
|
syntax is:</p>
|
|
|
|
<pre>
|
|
<tt>notify [%job ... ]
|
|
</tt>
|
|
</pre>
|
|
|
|
<p>By issuing <i>notify</i> with no operands, it causes the C shell to notify the user
|
|
asynchronously when the state of the current job changes. If given operands, <i>notify</i>
|
|
asynchronously informs the user of changes in the states of the specified jobs.</p>
|
|
|
|
<p>To add asynchronous notification to the POSIX shell, neither the KornShell extensions to <a href=
|
|
"../utilities/trap.html"><i>trap</i></a>, nor the C shell <i>notify</i> environment variable
|
|
seemed appropriate ( <i>notify</i> is not a proper POSIX environment variable name).</p>
|
|
|
|
<p>The <i>set</i> <b>-b</b> option was selected as a compromise.</p>
|
|
|
|
<p>The <i>notify</i> built-in was considered to have more functionality than was required
|
|
for simple asynchronous notification.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_127_19"></a>FUTURE DIRECTIONS</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_127_20"></a>SEE ALSO</h4>
|
|
|
|
<blockquote>
|
|
<p><a href="xcu_chap02.html#tag_02_14"><i>Special Built-In Utilities</i></a></p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_127_21"></a>CHANGE HISTORY</h4>
|
|
|
|
<h4><a name="tag_04_127_22"></a>Issue 6</h4>
|
|
|
|
<blockquote>
|
|
<p>The obsolescent <i>set</i> command name followed by <tt>'-'</tt> has been removed.</p>
|
|
|
|
<p>The following new requirements on POSIX implementations derive from alignment with the Single UNIX Specification:</p>
|
|
|
|
<ul>
|
|
<li>
|
|
<p>The <i>nolog</i> option is added to <i>set</i> <b>-o</b>.</p>
|
|
</li>
|
|
</ul>
|
|
|
|
<p>IEEE PASC Interpretation 1003.2 #167 is applied, clarifying that the options default also takes into account the description of
|
|
the option.</p>
|
|
</blockquote>
|
|
|
|
<div class="box"><em>End of informative text.</em></div>
|
|
|
|
<hr>
|
|
<hr size="2" noshade>
|
|
<center><font size="2"><!--footer start-->
|
|
UNIX ® is a registered Trademark of The Open Group.<br>
|
|
POSIX ® is a registered Trademark of The IEEE.<br>
|
|
[ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href=
|
|
"../utilities/contents.html">XCU</a> | <a href="../functions/contents.html">XSH</a> | <a href="../xrat/contents.html">XRAT</a>
|
|
]</font></center>
|
|
|
|
<!--footer end-->
|
|
<hr size="2" noshade>
|
|
</body>
|
|
</html>
|
|
|