218 lines
5.4 KiB
HTML
218 lines
5.4 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
|
<html>
|
|
<head>
|
|
<meta name="generator" content="HTML Tidy, see www.w3.org">
|
|
<meta http-equiv="Content-Type" content=
|
|
"text/html; charset=utf-8">
|
|
<title>set - Set or unset options and positional parameters</title>
|
|
<LINK rel="stylesheet" type="text/css" href="../rzahg/ic.css">
|
|
</HEAD>
|
|
<body bgcolor="#FFFFFF">
|
|
<!-- Java sync-link -->
|
|
<SCRIPT LANGUAGE="Javascript" SRC="../rzahg/synch.js" TYPE="text/javascript"></SCRIPT>
|
|
|
|
|
|
|
|
<h2>set - Set or unset options and positional parameters</h2>
|
|
|
|
<strong>Synopsis</strong>
|
|
|
|
<p><strong>set</strong> [ <strong>-abCefFjlmntuvx-</strong> ] [
|
|
<strong>-o</strong> <em>option</em> ] [ <em>argument</em> ... ]</p>
|
|
|
|
<p><strong>set</strong> [ <strong>+abCefFjlmntuvx-</strong> ] [
|
|
<strong>+o</strong> <em>option</em> ] [ <em>argument</em> ... ]</p>
|
|
|
|
<p><strong>Description</strong></p>
|
|
|
|
<p>The <strong>set</strong> utility can:</p>
|
|
|
|
<ul>
|
|
<li>Display the names and values of all shell variables by
|
|
specifying no options or arguments.</li>
|
|
|
|
<li>Display the option settings by specifying the <strong>
|
|
-o</strong> option but no <em>option</em>.</li>
|
|
|
|
<li>Set an option by specifying a <strong>-</strong> (minus)
|
|
followed by the option letter or by specifying <strong>-o</strong>
|
|
<em>option</em>.</li>
|
|
|
|
<li>Unset an option by specifying a <strong>+</strong> (plus)
|
|
followed by the option letter or by specifying <strong>+o</strong>
|
|
<em>option</em>.</li>
|
|
|
|
<li>Set positional parameters by specifying <em>
|
|
arguments</em>.</li>
|
|
|
|
<li>Unset positional parameters by specifying <strong>--</strong>
|
|
but no <em>argument</em>.</li>
|
|
</ul>
|
|
|
|
<p><strong>Options</strong></p>
|
|
|
|
<p>All of the single letter options have a corresponding <strong>
|
|
-o</strong> <em>option</em>. The option value is listed in
|
|
parenthesis following the letter option below. <strong>qsh</strong>
|
|
supports the following options:</p>
|
|
|
|
<dl>
|
|
<dt><strong>-a (allexport)</strong></dt>
|
|
|
|
<dd>Set the export attribute to each variable that is assigned a
|
|
value.</dd>
|
|
|
|
<dt><strong>-b (notify)</strong></dt>
|
|
|
|
<dd>Enable asynchronous notification of background job
|
|
completion.</dd>
|
|
|
|
<dt><strong>-C (noclobber)</strong></dt>
|
|
|
|
<dd>Do not overwrite existing files with the <strong>></strong>
|
|
redirection operator.</dd>
|
|
|
|
<dt><strong>-e (errexit)</strong></dt>
|
|
|
|
<dd>If the interactive option is not set, exit immediately if any
|
|
untested command fails. The exit status of a command is considered
|
|
to be explicitly tested if the command is used to control an
|
|
<strong>if</strong>, <strong>elif</strong>, <strong>while</strong>,
|
|
or <strong>until</strong>; or if the command is the left hand
|
|
operand of an <strong>&&</strong> or <strong>||</strong>
|
|
operator.</dd>
|
|
|
|
<dt><strong>-f (noglob)</strong></dt>
|
|
|
|
<dd>Disable path name expansion.</dd>
|
|
|
|
<dt><strong>-F (float)</strong></dt>
|
|
|
|
<dd>Enable floating point arithmetic in <a href="arithexp.htm">arithmetic
|
|
expressions.</a></dd>
|
|
|
|
<dt><strong>-j (jobtrace)</strong></dt>
|
|
|
|
<dd>Enable job tracing. Each time <strong>qsh</strong> starts a
|
|
i5/OS<SUP>(TM)</SUP> job, it displays a message to standard error with the
|
|
fully-qualified job name and process id.</dd>
|
|
|
|
<dt><strong>-l
|
|
(logcmds)</strong></dt>
|
|
|
|
<dd>Enable command logging. Write each command to a message in the job
|
|
log before it is run.</dd>
|
|
|
|
<dt><strong>-m (monitor)</strong></dt>
|
|
|
|
<dd>Display a message when a job completes. <strong>qsh</strong>
|
|
implicitly turns on this option when the interactive option is
|
|
set.</dd>
|
|
|
|
<dt><strong>-n (noexec)</strong></dt>
|
|
|
|
<dd>If the interactive option is not set, read commands but do not
|
|
run them. This is useful for checking the syntax of shell
|
|
scripts.</dd>
|
|
|
|
<dt><strong>-t (trace)</strong></dt>
|
|
|
|
<dd>Enable internal tracing. <strong>qsh</strong> traces internal
|
|
information to the file specified by <strong>TRACEFILE</strong>
|
|
variable or the qsh_trace file in the user's home directory.</dd>
|
|
|
|
<dt><strong>-u (nounset)</strong></dt>
|
|
|
|
<dd>Write a message to standard error when attempting to expand a
|
|
variable that is not set, and if the interactive option is not set
|
|
exit immediately.</dd>
|
|
|
|
<dt><strong>-v (verbose)</strong></dt>
|
|
|
|
<dd>Write input to standard error as it is read.</dd>
|
|
|
|
<dt><strong>-x (xtrace)</strong></dt>
|
|
|
|
<dd>Write each command to standard error before it is run, preceded
|
|
by the expansion of the <strong>PS4</strong> variable.</dd>
|
|
</dl>
|
|
|
|
<p><strong>Operands</strong></p>
|
|
|
|
<p>Each <em>argument</em> is assigned in order to the positional
|
|
parameters.</p>
|
|
|
|
<p><strong>Exit Status</strong></p>
|
|
|
|
<ul>
|
|
<li>0 when successful.</li>
|
|
</ul>
|
|
|
|
<p><strong>Related information</strong></p>
|
|
|
|
<ul>
|
|
<li><a href="export.htm">export - Set export attribute for
|
|
variables</a></li>
|
|
|
|
<li><a href="qsh.htm">qsh - Qshell command language
|
|
interpreter</a></li>
|
|
|
|
<li><a href="readonly.htm">readonly - Set read-only attribute for
|
|
variables</a></li>
|
|
|
|
<li><a href="shift.htm">shift - Shift positional
|
|
parameters</a></li>
|
|
|
|
<li><a href="unset.htm">unset - Unset values of variables and
|
|
functions</a></li>
|
|
</ul>
|
|
|
|
<strong>Examples</strong>
|
|
|
|
<ol>
|
|
<li>List all variables and their values:
|
|
<pre>
|
|
set
|
|
</pre></li>
|
|
|
|
<li>List all option settings:
|
|
<pre>
|
|
set -o
|
|
</pre></li>
|
|
|
|
<li>Set positional parameters $1, $2, $3:
|
|
<pre>
|
|
set alpha beta gamma
|
|
</pre></li>
|
|
|
|
<li>Set the allexport and notify options:
|
|
<pre>
|
|
set -o allexport -o notify
|
|
</pre></li>
|
|
|
|
<li>Set the verbose and xtrace options:
|
|
<pre>
|
|
set -xv
|
|
</pre></li>
|
|
|
|
<li>Unset the xtrace option:
|
|
<pre>
|
|
set +x
|
|
</pre></li>
|
|
|
|
<li>Unset the notify option:
|
|
<pre>
|
|
set +o notify
|
|
</pre></li>
|
|
|
|
<li>Unset all positional parameters:
|
|
<pre>
|
|
set --
|
|
</pre></li>
|
|
|
|
</ol>
|
|
|
|
</body>
|
|
</html>
|
|
|