Files
oldlinux-files/Ref-docs/POSIX/susv3/utilities/unset.html
2024-02-19 00:21:47 -05:00

215 lines
5.6 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>unset</title>
</head>
<body bgcolor="white">
<basefont size="3"> <a name="unset"></a> <a name="tag_04_160"></a><!-- unset -->
<!--header start-->
<center><font size="2">The Open Group Base Specifications Issue 6<br>
IEEE Std 1003.1-2001<br>
Copyright &copy; 2001 The IEEE and The Open Group, All Rights reserved.</font></center>
<!--header end-->
<hr size="2" noshade>
<h4><a name="tag_04_160_01"></a>NAME</h4>
<blockquote>unset - unset values and attributes of variables and functions</blockquote>
<h4><a name="tag_04_160_02"></a>SYNOPSIS</h4>
<blockquote class="synopsis">
<p><code><tt>unset</tt> <b>[</b><tt>-fv</tt><b>]</b> <i>name</i> <tt>...</tt></code></p>
</blockquote>
<h4><a name="tag_04_160_03"></a>DESCRIPTION</h4>
<blockquote>
<p>Each variable or function specified by <i>name</i> shall be unset.</p>
<p>If <b>-v</b> is specified, <i>name</i> refers to a variable name and the shell shall unset it and remove it from the
environment. Read-only variables cannot be unset.</p>
<p>If <b>-f</b> is specified, <i>name</i> refers to a function and the shell shall unset the function definition.</p>
<p>If neither <b>-f</b> nor <b>-v</b> is specified, <i>name</i> refers to a variable; if a variable by that name does not exist, it
is unspecified whether a function by that name, if any, shall be unset.</p>
<p>Unsetting a variable or function that was not previously set shall not be considered an error and does not cause the shell to
abort.</p>
<p>The <i>unset</i> special built-in shall support the Base Definitions volume of IEEE&nbsp;Std&nbsp;1003.1-2001, <a href=
"../basedefs/xbd_chap12.html#tag_12_02">Section 12.2, Utility Syntax Guidelines</a>.</p>
<p>Note that:</p>
<pre>
<tt>VARIABLE=
</tt>
</pre>
<p>is not equivalent to an <i>unset</i> of <b>VARIABLE</b>; in the example, <b>VARIABLE</b> is set to <tt>""</tt> . Also, the
variables that can be <i>unset</i> should not be misinterpreted to include the special parameters (see <a href=
"xcu_chap02.html#tag_02_05_02"><i>Special Parameters</i></a> ).</p>
</blockquote>
<h4><a name="tag_04_160_04"></a>OPTIONS</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_04_160_05"></a>OPERANDS</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_04_160_06"></a>STDIN</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_04_160_07"></a>INPUT FILES</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_04_160_08"></a>ENVIRONMENT VARIABLES</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_04_160_09"></a>ASYNCHRONOUS EVENTS</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_04_160_10"></a>STDOUT</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_04_160_11"></a>STDERR</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_04_160_12"></a>OUTPUT FILES</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_04_160_13"></a>EXTENDED DESCRIPTION</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_04_160_14"></a>EXIT STATUS</h4>
<blockquote>
<dl compact>
<dt>&nbsp;0</dt>
<dd>All <i>name</i> operands were successfully unset.</dd>
<dt>&gt;0</dt>
<dd>At least one <i>name</i> could not be unset.</dd>
</dl>
</blockquote>
<h4><a name="tag_04_160_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_160_16"></a>APPLICATION USAGE</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_04_160_17"></a>EXAMPLES</h4>
<blockquote>
<p>Unset <i>VISUAL</i> variable:</p>
<pre>
<tt>unset -v VISUAL
</tt>
</pre>
<p>Unset the functions <b>foo</b> and <b>bar</b>:</p>
<pre>
<tt>unset -f foo bar
</tt>
</pre>
</blockquote>
<h4><a name="tag_04_160_18"></a>RATIONALE</h4>
<blockquote>
<p>Consideration was given to omitting the <b>-f</b> option in favor of an
<i>unfunction</i> utility, but the standard developers decided to retain historical
practice.</p>
<p>The <b>-v</b> option was introduced because System V historically used one name space for both variables and functions. When
<i>unset</i> is used without options, System V historically unset either a function or a variable, and there was no confusion about
which one was intended. A portable POSIX application can use <i>unset</i> without an option to unset a variable, but not a
function; the <b>-f</b> option must be used.</p>
</blockquote>
<h4><a name="tag_04_160_19"></a>FUTURE DIRECTIONS</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_04_160_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_160_21"></a>CHANGE HISTORY</h4>
<blockquote>
<p>None.</p>
</blockquote>
<div class="box"><em>End of informative text.</em></div>
<hr>
<hr size="2" noshade>
<center><font size="2"><!--footer start-->
UNIX &reg; is a registered Trademark of The Open Group.<br>
POSIX &reg; 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>