Table of Contents

About

The supplied names (variable or function) are marked for automatic export to the environment of subsequently executed commands.

They are made available to all other command execution (script, …). You can see them with the env command.

When declaring a variable, you can also export it with the x option

Syntax

export [-fn] [name[=word]] ...
export -p
  • -f: the names refer to functions.
  • -p will print a list of all names that are exported in this shell.
  • The -n option causes the export property to be removed from each name.
  • =word will set the value of the variable to word

Return value

export returns an exit status of 0 unless:

  • an invalid option is encountered,
  • one of the names is not a valid shell variable name,
  • or -f is supplied with a name that is not a function.

Documentation / Reference