mirror of https://github.com/mkerrisk/man-pages
166 lines
4.0 KiB
Groff
166 lines
4.0 KiB
Groff
.\" Copyright (c) 2001-2003 The Open Group, All Rights Reserved
|
|
.TH "EXPORT" 1P 2003 "IEEE/The Open Group" "POSIX Programmer's Manual"
|
|
.\" export
|
|
.SH PROLOG
|
|
This manual page is part of the POSIX Programmer's Manual.
|
|
The Linux implementation of this interface may differ (consult
|
|
the corresponding Linux manual page for details of Linux behavior),
|
|
or the interface may not be implemented on Linux.
|
|
.SH NAME
|
|
export \- set the export attribute for variables
|
|
.SH SYNOPSIS
|
|
.LP
|
|
\fBexport name\fP\fB[\fP\fB=\fP\fIword\fP\fB]\fP\fB...
|
|
.br
|
|
.sp
|
|
export -p
|
|
.br
|
|
\fP
|
|
.SH DESCRIPTION
|
|
.LP
|
|
The shell shall give the \fIexport\fP attribute to the variables corresponding
|
|
to the specified \fIname\fPs, which shall cause
|
|
them to be in the environment of subsequently executed commands. If
|
|
the name of a variable is followed by = \fIword\fP, then the
|
|
value of that variable shall be set to \fIword\fP.
|
|
.LP
|
|
The \fIexport\fP special built-in shall support the Base Definitions
|
|
volume of IEEE\ Std\ 1003.1-2001, Section 12.2, Utility Syntax Guidelines.
|
|
.LP
|
|
When \fB-p\fP is specified, \fIexport\fP shall write to the standard
|
|
output the names and values of all exported variables, in
|
|
the following format:
|
|
.sp
|
|
.RS
|
|
.nf
|
|
|
|
\fB"export %s=%s\\n", <\fP\fIname\fP\fB>, <\fP\fIvalue\fP\fB>
|
|
\fP
|
|
.fi
|
|
.RE
|
|
.LP
|
|
if \fIname\fP is set, and:
|
|
.sp
|
|
.RS
|
|
.nf
|
|
|
|
\fB"export %s\\n", <\fP\fIname\fP\fB>
|
|
\fP
|
|
.fi
|
|
.RE
|
|
.LP
|
|
if \fIname\fP is unset.
|
|
.LP
|
|
The shell shall format the output, including the proper use of quoting,
|
|
so that it is suitable for reinput to the shell as
|
|
commands that achieve the same exporting results, except:
|
|
.IP " 1." 4
|
|
Read-only variables with values cannot be reset.
|
|
.LP
|
|
.IP " 2." 4
|
|
Variables that were unset at the time they were output need not be
|
|
reset to the unset state if a value is assigned to the
|
|
variable between the time the state was saved and the time at which
|
|
the saved output is reinput to the shell.
|
|
.LP
|
|
.LP
|
|
When no arguments are given, the results are unspecified.
|
|
.SH OPTIONS
|
|
.LP
|
|
See the DESCRIPTION.
|
|
.SH OPERANDS
|
|
.LP
|
|
See the DESCRIPTION.
|
|
.SH STDIN
|
|
.LP
|
|
Not used.
|
|
.SH INPUT FILES
|
|
.LP
|
|
None.
|
|
.SH ENVIRONMENT VARIABLES
|
|
.LP
|
|
None.
|
|
.SH ASYNCHRONOUS EVENTS
|
|
.LP
|
|
Default.
|
|
.SH STDOUT
|
|
.LP
|
|
See the DESCRIPTION.
|
|
.SH STDERR
|
|
.LP
|
|
The standard error shall be used only for diagnostic messages.
|
|
.SH OUTPUT FILES
|
|
.LP
|
|
None.
|
|
.SH EXTENDED DESCRIPTION
|
|
.LP
|
|
None.
|
|
.SH EXIT STATUS
|
|
.LP
|
|
Zero.
|
|
.SH CONSEQUENCES OF ERRORS
|
|
.LP
|
|
Default.
|
|
.LP
|
|
\fIThe following sections are informative.\fP
|
|
.SH APPLICATION USAGE
|
|
.LP
|
|
None.
|
|
.SH EXAMPLES
|
|
.LP
|
|
Export \fIPWD\fP and \fIHOME\fP variables:
|
|
.sp
|
|
.RS
|
|
.nf
|
|
|
|
\fBexport PWD HOME
|
|
\fP
|
|
.fi
|
|
.RE
|
|
.LP
|
|
Set and export the \fIPATH\fP variable:
|
|
.sp
|
|
.RS
|
|
.nf
|
|
|
|
\fBexport PATH=/local/bin:$PATH
|
|
\fP
|
|
.fi
|
|
.RE
|
|
.LP
|
|
Save and restore all exported variables:
|
|
.sp
|
|
.RS
|
|
.nf
|
|
|
|
\fBexport -p >\fP \fItemp-file\fP\fBunset\fP \fIa lot of variables\fP\fB...\fP \fIprocessing\fP\fB.\fP \fItemp-file\fP
|
|
.fi
|
|
.RE
|
|
.SH RATIONALE
|
|
.LP
|
|
Some historical shells use the no-argument case as the functional
|
|
equivalent of what is required here with \fB-p\fP. This
|
|
feature was left unspecified because it is not historical practice
|
|
in all shells, and some scripts may rely on the now-unspecified
|
|
results on their implementations. Attempts to specify the \fB-p\fP
|
|
output as the default case were unsuccessful in achieving
|
|
consensus. The \fB-p\fP option was added to allow portable access
|
|
to the values that can be saved and then later restored using;
|
|
for example, a \fIdot\fP script.
|
|
.SH FUTURE DIRECTIONS
|
|
.LP
|
|
None.
|
|
.SH SEE ALSO
|
|
.LP
|
|
\fISpecial Built-In Utilities\fP
|
|
.SH COPYRIGHT
|
|
Portions of this text are reprinted and reproduced in electronic form
|
|
from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
|
|
-- Portable Operating System Interface (POSIX), The Open Group Base
|
|
Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
|
|
Electrical and Electronics Engineers, Inc and The Open Group. In the
|
|
event of any discrepancy between this version and the original IEEE and
|
|
The Open Group Standard, the original IEEE and The Open Group Standard
|
|
is the referee document. The original Standard can be obtained online at
|
|
http://www.opengroup.org/unix/online.html .
|