1EXPORT(1P)                 POSIX Programmer's Manual                EXPORT(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       export — set the export attribute for variables
14

SYNOPSIS

16       export name[=word]...
17
18       export −p
19

DESCRIPTION

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 POSIX.1‐2008, 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           "export %s=%s\n", <name>, <value>
34
35       if name is set, and:
36
37           "export %s\n", <name>
38
39       if name is unset.
40
41       The shell shall format the output, including the proper use of quoting,
42       so  that  it  is  suitable  for  reinput  to the shell as commands that
43       achieve the same exporting results, except:
44
45        1. Read-only variables with values cannot be reset.
46
47        2. Variables that were unset at the time they were output need not  be
48           reset  to  the  unset  state if a value is assigned to the variable
49           between the time the state was saved and  the  time  at  which  the
50           saved output is reinput to the shell.
51
52       When no arguments are given, the results are unspecified. If a variable
53       assignment precedes the command name of export but that variable is not
54       also listed as an operand of export, then that variable shall be set in
55       the current shell execution environment after  the  completion  of  the
56       export  command,  but it is unspecified whether that variable is marked
57       for export.
58

OPTIONS

60       See the DESCRIPTION.
61

OPERANDS

63       See the DESCRIPTION.
64

STDIN

66       Not used.
67

INPUT FILES

69       None.
70

ENVIRONMENT VARIABLES

72       None.
73

ASYNCHRONOUS EVENTS

75       Default.
76

STDOUT

78       See the DESCRIPTION.
79

STDERR S

81       The standard error shall be used only for diagnostic messages.
82

OUTPUT FILES

84       None.
85

EXTENDED DESCRIPTION

87       None.
88

EXIT STATUS

90       Zero.
91

CONSEQUENCES OF ERRORS

93       Default.
94
95       The following sections are informative.
96

APPLICATION USAGE

98       None.
99

EXAMPLES

101       Export PWD and HOME variables:
102
103           export PWD HOME
104
105       Set and export the PATH variable:
106
107           export PATH=/local/bin:$PATH
108
109       Save and restore all exported variables:
110
111           export −p > temp-file
112           unset a lot of variables
113           ... processing
114           . temp-file
115

RATIONALE

117       Some historical shells use  the  no-argument  case  as  the  functional
118       equivalent  of  what  is  required here with −p.  This feature was left
119       unspecified because it is not historical practice in  all  shells,  and
120       some scripts may rely on the now-unspecified results on their implemen‐
121       tations. Attempts to specify the −p output as  the  default  case  were
122       unsuccessful  in achieving consensus.  The −p option was added to allow
123       portable access to the values that can be saved and then later restored
124       using; for example, a dot script.
125

FUTURE DIRECTIONS

127       None.
128

SEE ALSO

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