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 IEEE Std 1003.1-2001, 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 Special Parameters ).
45
47 See the DESCRIPTION.
48
50 See the DESCRIPTION.
51
53 Not used.
54
56 None.
57
59 None.
60
62 Default.
63
65 Not used.
66
68 The standard error shall be used only for diagnostic messages.
69
71 None.
72
74 None.
75
77 0 All name operands were successfully unset.
78
79 >0 At least one name could not be unset.
80
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 Special Built-In Utilities
118
120 Portions of this text are reprinted and reproduced in electronic form
121 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
122 -- Portable Operating System Interface (POSIX), The Open Group Base
123 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
124 Electrical and Electronics Engineers, Inc and The Open Group. In the
125 event of any discrepancy between this version and the original IEEE and
126 The Open Group Standard, the original IEEE and The Open Group Standard
127 is the referee document. The original Standard can be obtained online
128 at http://www.opengroup.org/unix/online.html .
129
130
131
132IEEE/The Open Group 2003 UNSET(1P)