export - Set a variable for export


  • export [ name [=value] ...]
  • export -p


export marks each variable name so that the current shell makes it automatically available to the environment of all commands run from that shell. Exported variables are thus available in the environment to all subsequent commands. Several commands (for example, cd, date and vi) look at environment variables for configuration or option information.

Variable assignments of the form name=value assign value to name as well as marking name for export. The name can contain only the underscore and alphanumeric characters from the portable character set.

Calling export without arguments lists, with appropriate quoting, the names and values of all variables in the format Variable="value". If you reinput this format to another shell, variables are assigned appropriately but not exported. The –p option lists variables in a format suitable for reinput to the shell (see the description of the –p option).


Lists variables in a form that is suitable for reinput to the shell:
export name="value"

Usage notes

export is a special built-in shell command.


export uses the following localization environment variables:
  • LANG
  • LC_ALL

See Localization for more information.

Exit values

Successful completion.
Failure due to incorrect command-line argument.
Failure, usually due to incorrect an incorrect command-line argument, that results in a usage message.


POSIX.2, X/Open Portability Guide.

Assigning a value to name, and the behavior given for calling export with arguments are extensions of the POSIX standard.

Related information

cd, date, set, sh, typeset, vi