Bash - Export (Builtin command)


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


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

Powered by ComboStrap