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

NAME

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

SYNOPSIS

15       unset [-fv] name...
16

DESCRIPTION

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

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
94           unset -v VISUAL
95
96       Unset the functions foo and bar:
97
98
99           unset -f foo bar
100

RATIONALE

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

FUTURE DIRECTIONS

114       None.
115

SEE ALSO

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)
Impressum