1EXPORT(1P) POSIX Programmer's Manual EXPORT(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 export - set the export attribute for variables
13
15 export name[=word]...
16
17 export -p
18
19
21 The shell shall give the export attribute to the variables correspond‐
22 ing to the specified names, which shall cause them to be in the envi‐
23 ronment of subsequently executed commands. If the name of a variable is
24 followed by = word, then the value of that variable shall be set to
25 word.
26
27 The export special built-in shall support the Base Definitions volume
28 of IEEE Std 1003.1-2001, Section 12.2, Utility Syntax Guidelines.
29
30 When -p is specified, export shall write to the standard output the
31 names and values of all exported variables, in the following format:
32
33
34 "export %s=%s\n", <name>, <value>
35
36 if name is set, and:
37
38
39 "export %s\n", <name>
40
41 if name is unset.
42
43 The shell shall format the output, including the proper use of quoting,
44 so that it is suitable for reinput to the shell as commands that
45 achieve the same exporting results, except:
46
47 1. Read-only variables with values cannot be reset.
48
49 2. Variables that were unset at the time they were output need not be
50 reset to the unset state if a value is assigned to the variable
51 between the time the state was saved and the time at which the
52 saved output is reinput to the shell.
53
54 When no arguments are given, the results are unspecified.
55
57 See the DESCRIPTION.
58
60 See the DESCRIPTION.
61
63 Not used.
64
66 None.
67
69 None.
70
72 Default.
73
75 See the DESCRIPTION.
76
78 The standard error shall be used only for diagnostic messages.
79
81 None.
82
84 None.
85
87 Zero.
88
90 Default.
91
92 The following sections are informative.
93
95 None.
96
98 Export PWD and HOME variables:
99
100
101 export PWD HOME
102
103 Set and export the PATH variable:
104
105
106 export PATH=/local/bin:$PATH
107
108 Save and restore all exported variables:
109
110
111 export -p > temp-fileunset a lot of variables... processing. temp-file
112
114 Some historical shells use the no-argument case as the functional
115 equivalent of what is required here with -p. This feature was left
116 unspecified because it is not historical practice in all shells, and
117 some scripts may rely on the now-unspecified results on their implemen‐
118 tations. Attempts to specify the -p output as the default case were
119 unsuccessful in achieving consensus. The -p option was added to allow
120 portable access to the values that can be saved and then later restored
121 using; for example, a dot script.
122
124 None.
125
127 Special Built-In Utilities
128
130 Portions of this text are reprinted and reproduced in electronic form
131 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
132 -- Portable Operating System Interface (POSIX), The Open Group Base
133 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
134 Electrical and Electronics Engineers, Inc and The Open Group. In the
135 event of any discrepancy between this version and the original IEEE and
136 The Open Group Standard, the original IEEE and The Open Group Standard
137 is the referee document. The original Standard can be obtained online
138 at http://www.opengroup.org/unix/online.html .
139
140
141
142IEEE/The Open Group 2003 EXPORT(1P)