1UNSET(1P) POSIX Programmer's Manual UNSET(1P)
2
3
4
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
12 unset — unset values and attributes of variables and functions
13
15 unset [-fv] name...
16
18 Each variable or function specified by name shall be unset.
19
20 If -v is specified, name refers to a variable name and the shell shall
21 unset it and remove it from the environment. Read-only variables cannot
22 be unset.
23
24 If -f is specified, name refers to a function and the shell shall unset
25 the function definition.
26
27 If neither -f nor -v is specified, name refers to a variable; if a
28 variable by that name does not exist, it is unspecified whether a func‐
29 tion by that name, if any, shall be unset.
30
31 Unsetting a variable or function that was not previously set shall not
32 be considered an error and does not cause the shell to abort.
33
34 The unset special built-in shall support the Base Definitions volume of
35 POSIX.1‐2017, Section 12.2, Utility Syntax Guidelines.
36
37 Note that:
38
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
48 See the DESCRIPTION.
49
51 See the DESCRIPTION.
52
54 Not used.
55
57 None.
58
60 None.
61
63 Default.
64
66 Not used.
67
69 The standard error shall be used only for diagnostic messages.
70
72 None.
73
75 None.
76
78 0 All name operands were successfully unset.
79
80 >0 At least one name could not be unset.
81
83 Default.
84
85 The following sections are informative.
86
88 None.
89
91 Unset VISUAL variable:
92
93
94 unset -v VISUAL
95
96 Unset the functions foo and bar:
97
98
99 unset -f foo bar
100
102 Consideration was given to omitting the -f option in favor of an
103 unfunction utility, but the standard developers decided to retain his‐
104 torical practice.
105
106 The -v option was introduced because System V historically used one
107 name space for both variables and functions. When unset is used without
108 options, System V historically unset either a function or a variable,
109 and there was no confusion about which one was intended. A portable
110 POSIX application can use unset without an option to unset a variable,
111 but not a function; the -f option must be used.
112
114 None.
115
117 Section 2.14, Special Built-In Utilities
118
119 The Base Definitions volume of POSIX.1‐2017, Section 12.2, Utility Syn‐
120 tax Guidelines
121
123 Portions of this text are reprinted and reproduced in electronic form
124 from IEEE Std 1003.1-2017, Standard for Information Technology -- Por‐
125 table Operating System Interface (POSIX), The Open Group Base Specifi‐
126 cations Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of
127 Electrical and Electronics Engineers, Inc and The Open Group. In the
128 event of any discrepancy between this version and the original IEEE and
129 The Open Group Standard, the original IEEE and The Open Group Standard
130 is the referee document. The original Standard can be obtained online
131 at http://www.opengroup.org/unix/online.html .
132
133 Any typographical or formatting errors that appear in this page are
134 most likely to have been introduced during the conversion of the source
135 files to man page format. To report such errors, see https://www.ker‐
136 nel.org/doc/man-pages/reporting_bugs.html .
137
138
139
140IEEE/The Open Group 2017 UNSET(1P)