1UNSET(P)                   POSIX Programmer's Manual                  UNSET(P)
2
3
4

NAME

6       unset - unset values and attributes of variables and functions
7

SYNOPSIS

9       unset [-fv] name ...
10

DESCRIPTION

12       Each variable or function specified by name shall be unset.
13
14       If  -v is specified, name refers to a variable name and the shell shall
15       unset it and remove it from the environment. Read-only variables cannot
16       be unset.
17
18       If -f is specified, name refers to a function and the shell shall unset
19       the function definition.
20
21       If neither -f nor -v is specified, name refers  to  a  variable;  if  a
22       variable by that name does not exist, it is unspecified whether a func‐
23       tion by that name, if any, shall be unset.
24
25       Unsetting a variable or function that was not previously set shall  not
26       be considered an error and does not cause the shell to abort.
27
28       The unset special built-in shall support the Base Definitions volume of
29       IEEE Std 1003.1-2001, Section 12.2, Utility Syntax Guidelines.
30
31       Note that:
32
33
34              VARIABLE=
35
36       is not equivalent to an unset of VARIABLE; in the example, VARIABLE  is
37       set  to "" . Also, the variables that can be unset should not be misin‐
38       terpreted to include the special parameters (see Special Parameters ).
39

OPTIONS

41       See the DESCRIPTION.
42

OPERANDS

44       See the DESCRIPTION.
45

STDIN

47       Not used.
48

INPUT FILES

50       None.
51

ENVIRONMENT VARIABLES

53       None.
54

ASYNCHRONOUS EVENTS

56       Default.
57

STDOUT

59       Not used.
60

STDERR

62       The standard error shall be used only for diagnostic messages.
63

OUTPUT FILES

65       None.
66

EXTENDED DESCRIPTION

68       None.
69

EXIT STATUS

71        0     All name operands were successfully unset.
72
73       >0     At least one name could not be unset.
74
75

CONSEQUENCES OF ERRORS

77       Default.
78
79       The following sections are informative.
80

APPLICATION USAGE

82       None.
83

EXAMPLES

85       Unset VISUAL variable:
86
87
88              unset -v VISUAL
89
90       Unset the functions foo and bar:
91
92
93              unset -f foo bar
94

RATIONALE

96       Consideration was given to omitting  the  -f  option  in  favor  of  an
97       unfunction  utility, but the standard developers decided to retain his‐
98       torical practice.
99
100       The -v option was introduced because System  V  historically  used  one
101       name space for both variables and functions. When unset is used without
102       options, System V historically unset either a function or  a  variable,
103       and  there  was  no  confusion about which one was intended. A portable
104       POSIX application can use unset without an option to unset a  variable,
105       but not a function; the -f option must be used.
106

FUTURE DIRECTIONS

108       None.
109

SEE ALSO

111       Special Built-In Utilities
112
114       Portions  of  this text are reprinted and reproduced in electronic form
115       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
116       --  Portable  Operating  System  Interface (POSIX), The Open Group Base
117       Specifications Issue 6, Copyright (C) 2001-2003  by  the  Institute  of
118       Electrical  and  Electronics  Engineers, Inc and The Open Group. In the
119       event of any discrepancy between this version and the original IEEE and
120       The  Open Group Standard, the original IEEE and The Open Group Standard
121       is the referee document. The original Standard can be  obtained  online
122       at http://www.opengroup.org/unix/online.html .
123
124
125
126IEEE/The Open Group                  2003                             UNSET(P)
Impressum