1EXPORT(P)                  POSIX Programmer's Manual                 EXPORT(P)
2
3
4

NAME

6       export - set the export attribute for variables
7

SYNOPSIS

9       export name[=word]...
10
11       export -p
12
13

DESCRIPTION

15       The  shell shall give the export attribute to the variables correspond‐
16       ing to the specified names, which shall cause them to be in  the  envi‐
17       ronment of subsequently executed commands. If the name of a variable is
18       followed by = word, then the value of that variable  shall  be  set  to
19       word.
20
21       The  export  special built-in shall support the Base Definitions volume
22       of IEEE Std 1003.1-2001, Section 12.2, Utility Syntax Guidelines.
23
24       When -p is specified, export shall write to  the  standard  output  the
25       names and values of all exported variables, in the following format:
26
27
28              "export %s=%s\n", <name>, <value>
29
30       if name is set, and:
31
32
33              "export %s\n", <name>
34
35       if name is unset.
36
37       The shell shall format the output, including the proper use of quoting,
38       so that it is suitable for  reinput  to  the  shell  as  commands  that
39       achieve the same exporting results, except:
40
41        1. Read-only variables with values cannot be reset.
42
43        2. Variables  that were unset at the time they were output need not be
44           reset to the unset state if a value is  assigned  to  the  variable
45           between  the  time  the  state  was saved and the time at which the
46           saved output is reinput to the shell.
47
48       When no arguments are given, the results are unspecified.
49

OPTIONS

51       See the DESCRIPTION.
52

OPERANDS

54       See the DESCRIPTION.
55

STDIN

57       Not used.
58

INPUT FILES

60       None.
61

ENVIRONMENT VARIABLES

63       None.
64

ASYNCHRONOUS EVENTS

66       Default.
67

STDOUT

69       See the DESCRIPTION.
70

STDERR

72       The standard error shall be used only for diagnostic messages.
73

OUTPUT FILES

75       None.
76

EXTENDED DESCRIPTION

78       None.
79

EXIT STATUS

81       Zero.
82

CONSEQUENCES OF ERRORS

84       Default.
85
86       The following sections are informative.
87

APPLICATION USAGE

89       None.
90

EXAMPLES

92       Export PWD and HOME variables:
93
94
95              export PWD HOME
96
97       Set and export the PATH variable:
98
99
100              export PATH=/local/bin:$PATH
101
102       Save and restore all exported variables:
103
104
105              export -p > temp-fileunset a lot of variables... processing. temp-file
106

RATIONALE

108       Some historical shells use  the  no-argument  case  as  the  functional
109       equivalent  of  what  is  required  here with -p. This feature was left
110       unspecified because it is not historical practice in  all  shells,  and
111       some scripts may rely on the now-unspecified results on their implemen‐
112       tations. Attempts to specify the -p output as  the  default  case  were
113       unsuccessful  in  achieving consensus. The -p option was added to allow
114       portable access to the values that can be saved and then later restored
115       using; for example, a dot script.
116

FUTURE DIRECTIONS

118       None.
119

SEE ALSO

121       Special Built-In Utilities
122
124       Portions  of  this text are reprinted and reproduced in electronic form
125       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
126       --  Portable  Operating  System  Interface (POSIX), The Open Group Base
127       Specifications Issue 6, Copyright (C) 2001-2003  by  the  Institute  of
128       Electrical  and  Electronics  Engineers, Inc and The Open Group. In the
129       event of any discrepancy between this version and the original IEEE and
130       The  Open Group Standard, the original IEEE and The Open Group Standard
131       is the referee document. The original Standard can be  obtained  online
132       at http://www.opengroup.org/unix/online.html .
133
134
135
136IEEE/The Open Group                  2003                            EXPORT(P)
Impressum