mirror of https://github.com/mkerrisk/man-pages
143 lines
3.5 KiB
Groff
143 lines
3.5 KiB
Groff
|
.\" Copyright (c) 2001-2003 The Open Group, All Rights Reserved
|
||
|
.TH "UNSET" P 2003 "IEEE/The Open Group" "POSIX Programmer's Manual"
|
||
|
.\" unset
|
||
|
.SH NAME
|
||
|
unset \- unset values and attributes of variables and functions
|
||
|
.SH SYNOPSIS
|
||
|
.LP
|
||
|
\fBunset\fP \fB[\fP\fB-fv\fP\fB]\fP \fIname\fP \fB...\fP
|
||
|
.SH DESCRIPTION
|
||
|
.LP
|
||
|
Each variable or function specified by \fIname\fP shall be unset.
|
||
|
.LP
|
||
|
If \fB-v\fP is specified, \fIname\fP refers to a variable name and
|
||
|
the shell shall unset it and remove it from the
|
||
|
environment. Read-only variables cannot be unset.
|
||
|
.LP
|
||
|
If \fB-f\fP is specified, \fIname\fP refers to a function and the
|
||
|
shell shall unset the function definition.
|
||
|
.LP
|
||
|
If neither \fB-f\fP nor \fB-v\fP is specified, \fIname\fP 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.
|
||
|
.LP
|
||
|
Unsetting a variable or function that was not previously set shall
|
||
|
not be considered an error and does not cause the shell to
|
||
|
abort.
|
||
|
.LP
|
||
|
The \fIunset\fP special built-in shall support the Base Definitions
|
||
|
volume of IEEE\ Std\ 1003.1-2001, Section 12.2, Utility Syntax Guidelines.
|
||
|
.LP
|
||
|
Note that:
|
||
|
.sp
|
||
|
.RS
|
||
|
.nf
|
||
|
|
||
|
\fBVARIABLE=
|
||
|
\fP
|
||
|
.fi
|
||
|
.RE
|
||
|
.LP
|
||
|
is not equivalent to an \fIunset\fP of \fBVARIABLE\fP; in the example,
|
||
|
\fBVARIABLE\fP is set to \fB""\fP . Also, the
|
||
|
variables that can be \fIunset\fP should not be misinterpreted to
|
||
|
include the special parameters (see \fISpecial Parameters\fP ).
|
||
|
.SH OPTIONS
|
||
|
.LP
|
||
|
See the DESCRIPTION.
|
||
|
.SH OPERANDS
|
||
|
.LP
|
||
|
See the DESCRIPTION.
|
||
|
.SH STDIN
|
||
|
.LP
|
||
|
Not used.
|
||
|
.SH INPUT FILES
|
||
|
.LP
|
||
|
None.
|
||
|
.SH ENVIRONMENT VARIABLES
|
||
|
.LP
|
||
|
None.
|
||
|
.SH ASYNCHRONOUS EVENTS
|
||
|
.LP
|
||
|
Default.
|
||
|
.SH STDOUT
|
||
|
.LP
|
||
|
Not used.
|
||
|
.SH STDERR
|
||
|
.LP
|
||
|
The standard error shall be used only for diagnostic messages.
|
||
|
.SH OUTPUT FILES
|
||
|
.LP
|
||
|
None.
|
||
|
.SH EXTENDED DESCRIPTION
|
||
|
.LP
|
||
|
None.
|
||
|
.SH EXIT STATUS
|
||
|
.TP 7
|
||
|
\ 0
|
||
|
All \fIname\fP operands were successfully unset.
|
||
|
.TP 7
|
||
|
>0
|
||
|
At least one \fIname\fP could not be unset.
|
||
|
.sp
|
||
|
.SH CONSEQUENCES OF ERRORS
|
||
|
.LP
|
||
|
Default.
|
||
|
.LP
|
||
|
\fIThe following sections are informative.\fP
|
||
|
.SH APPLICATION USAGE
|
||
|
.LP
|
||
|
None.
|
||
|
.SH EXAMPLES
|
||
|
.LP
|
||
|
Unset \fIVISUAL\fP variable:
|
||
|
.sp
|
||
|
.RS
|
||
|
.nf
|
||
|
|
||
|
\fBunset -v VISUAL
|
||
|
\fP
|
||
|
.fi
|
||
|
.RE
|
||
|
.LP
|
||
|
Unset the functions \fBfoo\fP and \fBbar\fP:
|
||
|
.sp
|
||
|
.RS
|
||
|
.nf
|
||
|
|
||
|
\fBunset -f foo bar
|
||
|
\fP
|
||
|
.fi
|
||
|
.RE
|
||
|
.SH RATIONALE
|
||
|
.LP
|
||
|
Consideration was given to omitting the \fB-f\fP option in favor of
|
||
|
an
|
||
|
\fIunfunction\fP utility, but the standard developers decided to retain
|
||
|
historical
|
||
|
practice.
|
||
|
.LP
|
||
|
The \fB-v\fP option was introduced because System V historically used
|
||
|
one name space for both variables and functions. When
|
||
|
\fIunset\fP 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 \fIunset\fP
|
||
|
without an option to unset a variable, but not a
|
||
|
function; the \fB-f\fP option must be used.
|
||
|
.SH FUTURE DIRECTIONS
|
||
|
.LP
|
||
|
None.
|
||
|
.SH SEE ALSO
|
||
|
.LP
|
||
|
\fISpecial Built-In Utilities\fP
|
||
|
.SH COPYRIGHT
|
||
|
Portions of this text are reprinted and reproduced in electronic form
|
||
|
from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
|
||
|
-- Portable Operating System Interface (POSIX), The Open Group Base
|
||
|
Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
|
||
|
Electrical and Electronics Engineers, Inc and The Open Group. In the
|
||
|
event of any discrepancy between this version and the original IEEE and
|
||
|
The Open Group Standard, the original IEEE and The Open Group Standard
|
||
|
is the referee document. The original Standard can be obtained online at
|
||
|
http://www.opengroup.org/unix/online.html .
|