Bash - Export (Builtin command)

1 - About

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

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

3 - 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

4 - 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.

5 - Documentation / Reference

lang/bash/export.txt ยท Last modified: 2018/07/10 10:02 by gerardnico