227 lines
5.9 KiB
HTML
227 lines
5.9 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<html>
|
|
<head>
|
|
<meta name="generator" content="HTML Tidy, see www.w3.org">
|
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
|
<link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group's rhtm tool v1.2.1 -->
|
|
<!-- Copyright (c) 2001 The Open Group, All Rights Reserved -->
|
|
<title>export</title>
|
|
</head>
|
|
<body bgcolor="white">
|
|
|
|
<basefont size="3"> <a name="export"></a> <a name="tag_04_49"></a><!-- export -->
|
|
<!--header start-->
|
|
<center><font size="2">The Open Group Base Specifications Issue 6<br>
|
|
IEEE Std 1003.1-2001<br>
|
|
Copyright © 2001 The IEEE and The Open Group, All Rights reserved.</font></center>
|
|
|
|
<!--header end-->
|
|
<hr size="2" noshade>
|
|
<h4><a name="tag_04_49_01"></a>NAME</h4>
|
|
|
|
<blockquote>export - set the export attribute for variables</blockquote>
|
|
|
|
<h4><a name="tag_04_49_02"></a>SYNOPSIS</h4>
|
|
|
|
<blockquote class="synopsis">
|
|
<p><code><tt>export name</tt><b>[</b><tt>=</tt><i>word</i><b>]</b><tt>...<br>
|
|
<br>
|
|
export -p<br>
|
|
</tt></code></p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_49_03"></a>DESCRIPTION</h4>
|
|
|
|
<blockquote>
|
|
<p>The shell shall give the <i>export</i> attribute to the variables corresponding to the specified <i>name</i>s, which shall cause
|
|
them to be in the environment of subsequently executed commands.</p>
|
|
|
|
<p>The <i>export</i> special built-in shall support the Base Definitions volume of IEEE Std 1003.1-2001, <a href=
|
|
"../basedefs/xbd_chap12.html#tag_12_02">Section 12.2, Utility Syntax Guidelines</a>.</p>
|
|
|
|
<p>When <b>-p</b> is specified, <i>export</i> shall write to the standard output the names and values of all exported variables, in
|
|
the following format:</p>
|
|
|
|
<pre>
|
|
<tt>"export %s=%s\n", <</tt><i>name</i><tt>>, <</tt><i>value</i><tt>>
|
|
</tt>
|
|
</pre>
|
|
|
|
<p>if <i>name</i> is set, and:</p>
|
|
|
|
<pre>
|
|
<tt>"export %s\n", <</tt><i>name</i><tt>>
|
|
</tt>
|
|
</pre>
|
|
|
|
<p>if <i>name</i> is unset.</p>
|
|
|
|
<p>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:</p>
|
|
|
|
<ol>
|
|
<li>
|
|
<p>Read-only variables with values cannot be reset.</p>
|
|
</li>
|
|
|
|
<li>
|
|
<p>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.</p>
|
|
</li>
|
|
</ol>
|
|
|
|
<p>When no arguments are given, the results are unspecified.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_49_04"></a>OPTIONS</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_49_05"></a>OPERANDS</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_49_06"></a>STDIN</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_49_07"></a>INPUT FILES</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_49_08"></a>ENVIRONMENT VARIABLES</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_49_09"></a>ASYNCHRONOUS EVENTS</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_49_10"></a>STDOUT</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_49_11"></a>STDERR</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_49_12"></a>OUTPUT FILES</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_49_13"></a>EXTENDED DESCRIPTION</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_49_14"></a>EXIT STATUS</h4>
|
|
|
|
<blockquote>
|
|
<p>Zero.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_49_15"></a>CONSEQUENCES OF ERRORS</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<hr>
|
|
<div class="box"><em>The following sections are informative.</em></div>
|
|
|
|
<h4><a name="tag_04_49_16"></a>APPLICATION USAGE</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_49_17"></a>EXAMPLES</h4>
|
|
|
|
<blockquote>
|
|
<p>Export <i>PWD</i> and <i>HOME</i> variables:</p>
|
|
|
|
<pre>
|
|
<tt>export PWD HOME
|
|
</tt>
|
|
</pre>
|
|
|
|
<p>Set and export the <i>PATH</i> variable:</p>
|
|
|
|
<pre>
|
|
<tt>export PATH=/local/bin:$PATH
|
|
</tt>
|
|
</pre>
|
|
|
|
<p>Save and restore all exported variables:</p>
|
|
|
|
<pre>
|
|
<tt>export -p ></tt> <i>temp-file</i><tt>unset</tt> <i>a lot of variables</i><tt>...</tt> <i>processing</i><tt>.</tt> <i>temp-file</i>
|
|
</pre>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_49_18"></a>RATIONALE</h4>
|
|
|
|
<blockquote>
|
|
<p>Some historical shells use the no-argument case as the functional equivalent of what is required here with <b>-p</b>. 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 <b>-p</b> output as the default case were unsuccessful in achieving
|
|
consensus. The <b>-p</b> option was added to allow portable access to the values that can be saved and then later restored using;
|
|
for example, a <a href="../utilities/dot.html"><i>dot</i></a> script.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_49_19"></a>FUTURE DIRECTIONS</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_49_20"></a>SEE ALSO</h4>
|
|
|
|
<blockquote>
|
|
<p><a href="xcu_chap02.html#tag_02_14"><i>Special Built-In Utilities</i></a></p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_49_21"></a>CHANGE HISTORY</h4>
|
|
|
|
<h4><a name="tag_04_49_22"></a>Issue 6</h4>
|
|
|
|
<blockquote>
|
|
<p>IEEE PASC Interpretation 1003.2 #203 is applied, clarifying the format when a variable is unset.</p>
|
|
</blockquote>
|
|
|
|
<div class="box"><em>End of informative text.</em></div>
|
|
|
|
<hr>
|
|
<hr size="2" noshade>
|
|
<center><font size="2"><!--footer start-->
|
|
UNIX ® is a registered Trademark of The Open Group.<br>
|
|
POSIX ® is a registered Trademark of The IEEE.<br>
|
|
[ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href=
|
|
"../utilities/contents.html">XCU</a> | <a href="../functions/contents.html">XSH</a> | <a href="../xrat/contents.html">XRAT</a>
|
|
]</font></center>
|
|
|
|
<!--footer end-->
|
|
<hr size="2" noshade>
|
|
</body>
|
|
</html>
|
|
|