EXPORT(1SH) COMMAND REFERENCE EXPORT(1SH)
NAME
export - exports variables to the environment (sh built-in)
SYNOPSIS
export [ name . . . ]
DESCRIPTION
The 'environment' consists of a list of names and
corresponding values which contain information that the user
wants all processes to know about. When a file is executed,
a copy of the environment is given to the process. In sh,
the names in the environment are copied into shell variables
for use in shell scripts. In order to change the values of
the entries in the environment, the export command must be
used.
The given names are marked for automatic export to the
environment of subsequently executed commands. If no
arguments are given, a list of names marked for export is
printed. Note that this command is not a verb, meaning that
the variable is marked for export, not put in the
environment immediately.
If the -a option is set, all variables are marked for export
when set or changed.
Variables which have not been marked for export are not
copied into the environment, which means that the current
value will not be known by any child processes. There is no
way for a child to change the environment of its parent.
Shell functions may not be exported.
There is an alternate way of changing the environment for a
single command. If the command name is preceded by variable
assignments, these values are copied into the environment
for the execution of the command. For example, the line:
TERM=aaa printenv TERM
will cause the word 'aaa' to be printed, no matter what TERM
was set to before. The value of the variable is not changed
in the current shell.
OPTIONS
-a Marks all variables for export when set or changed.
EXAMPLES
Certain variables, such as TERM and TERMCAP, are set during
execution of the .profile file. These must be exported so
that programs such as ex and more may use them. The
following portion of the .profile file sets the TERM and
Printed 4/6/89 1
EXPORT(1SH) COMMAND REFERENCE EXPORT(1SH)
TERMCAP variables and exports them for use by other
programs.
TERM=aaa-30-s
TERMCAP=/etc/termcap
export TERM TERMCAP
RETURN VALUE
[NO_ERRS] Command completed without error.
SEE ALSO
break(1sh), cd(1sh), chdir(1sh), continue(1sh), csh(1csh),
echo(1sh), eval(1sh), exec(1sh), exit(1sh), hash(1sh),
login(1), pwd(1sh), read(1sh), readonly(1sh), return(1sh),
set(1sh), sh(1sh), shift(1sh), test(1sh), times(1sh),
trap(1sh), type(1sh), ulimit(1sh), umask(1sh), unset(1sh),
wait(1sh), which(1sh), execve(2), getenv(3c), and
environ(7).
Printed 4/6/89 2
%%index%%
na:336,115;
sy:451,186;
de:637,1844;
op:2481,159;
ex:2640,376;3424,160;
rv:3584,177;
se:3761,943;
%%index%%000000000131