export(1) export(1)
NAME
export - export shell variables
SYNOPSIS
export [name ...]
DESCRIPTION
The shell built-in export marks the specified shell variable for
export. This means that the name of this variable and its value will
subsequently be known and accessible to all commands.
If export is invoked without arguments, the names of all shell vari-
ables that have been exported in the current shell are listed on stan-
dard output.
Exported variables are deleted when the shell in which they were
defined and exported is terminated. Frequently used variables should
therefore be defined and exported in the $HOME/.profile file.
Positional parameters and shell functions cannot be exported. Some
standard variables of the shell are available in all subshells without
needing to be exported. These include HOME, IFS, PATH, PS1 and PS2. If
you wish to assign some other value to these variables, and if the
modified value is to be valid in every subshell, you will need to
export these variables. Otherwise, the default value is valid in each
subshell.
The shell built-in set displays the names and values of all variables
defined in the current shell, including those that have not been
exported.
The env command lists the names and values of all shell variables that
are passed to each invoked command and each subshell. Variables such
as IFS, MAILCHECK, PATH, PS1 and PS2 are contained in this output only
if they have been exported with export.
OPERANDS
The Korn shell ksh supports additional options, and the values to be
exported can be assigned a value [see ksh(1)].
name Name of the shell variable you want to export. This variable can
also be assigned a value either before or after the export call.
You can specify as many shell variables as you like; they must
be separated from one another by a blank.
name not specified:
All shell variables exported in the current shell are written to
standard output. The output is generated in the following for-
mat:
Page 1 Reliant UNIX 5.44 Printed 11/98
export(1) export(1)
export name
and for the Korn shell ksh:
name=value
or, if the -p option is set:
export name=value
LOCALE
The LCMESSAGES environment variable governs the language in which
message texts are displayed. If LCMESSAGES is undefined or is defined
as the null string, it defaults to the value of LANG. If LANG is like-
wise undefined or null, the system acts as if it were not internation-
alized.
EXAMPLES
The shell script editor is to display the value of the EDITOR vari-
able. The script file contains the following:
: Invocation with sh editor
echo EDITOR: $EDITOR
The following interactive session demonstrates why the shell variable
EDITOR has to be exported:
$ export
export HOME
export PATH
export PS1
$ EDITOR=vi
$ sh editor
EDITOR:
$ export EDITOR
$ export
export HOME
export PATH
export PS1
export EDITOR
$ sh editor
EDITOR: vi
When you define a shell variable, it is only known in the current
shell. Since a shell script is always run by a subshell, variables for
shell scripts have to be exported.
NOTES
Some differences in behavior may occur when using export, depending on
which shell is being used. The possible differences are not described
specifically.
Page 2 Reliant UNIX 5.44 Printed 11/98
export(1) export(1)
SEE ALSO
env(1), ksh(1), set(1), sh(1).
Page 3 Reliant UNIX 5.44 Printed 11/98