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

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10
11

NAME

13       unset — unset values and attributes of variables and functions
14

SYNOPSIS

16       unset [−fv] name...
17

DESCRIPTION

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

OPTIONS

48       See the DESCRIPTION.
49

OPERANDS

51       See the DESCRIPTION.
52

STDIN

54       Not used.
55

INPUT FILES

57       None.
58

ENVIRONMENT VARIABLES

60       None.
61

ASYNCHRONOUS EVENTS

63       Default.
64

STDOUT

66       Not used.
67

STDERR

69       The standard error shall be used only for diagnostic messages.
70

OUTPUT FILES

72       None.
73

EXTENDED DESCRIPTION

75       None.
76

EXIT STATUS

78        0    All name operands were successfully unset.
79
80       >0    At least one name could not be unset.
81

CONSEQUENCES OF ERRORS

83       Default.
84
85       The following sections are informative.
86

APPLICATION USAGE

88       None.
89

EXAMPLES

91       Unset VISUAL variable:
92
93           unset −v VISUAL
94
95       Unset the functions foo and bar:
96
97           unset −f foo bar
98

RATIONALE

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

FUTURE DIRECTIONS

112       None.
113

SEE ALSO

115       Section 2.14, Special Built-In Utilities
116
117       The Base Definitions volume of POSIX.1‐2008, Section 12.2, Utility Syn‐
118       tax Guidelines
119
121       Portions of this text are reprinted and reproduced in  electronic  form
122       from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
123       -- Portable Operating System Interface (POSIX),  The  Open  Group  Base
124       Specifications Issue 7, Copyright (C) 2013 by the Institute of Electri‐
125       cal and Electronics Engineers,  Inc  and  The  Open  Group.   (This  is
126       POSIX.1-2008  with  the  2013  Technical Corrigendum 1 applied.) In the
127       event of any discrepancy between this version and the original IEEE and
128       The  Open Group Standard, the original IEEE and The Open Group Standard
129       is the referee document. The original Standard can be  obtained  online
130       at http://www.unix.org/online.html .
131
132       Any  typographical  or  formatting  errors that appear in this page are
133       most likely to have been introduced during the conversion of the source
134       files  to  man page format. To report such errors, see https://www.ker
135       nel.org/doc/man-pages/reporting_bugs.html .
136
137
138
139IEEE/The Open Group                  2013                            UNSET(1P)
Impressum