Set an environment variable. The supplied names are marked for automatic export to the environment of subsequently executed commands.

      export [-fn] [name[=word]] ...
export -p Key -f The names refer to functions. word The value of the variable is set to word. -n Remove the export property from each name. -p Print a list of all the names exported in this shell. This is also the default action if no name is given

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.

export is a bash built in command.


Set the shell variable 'MYDEPT' equal to 'Sales' :

echo $MYDEPT

To make the change permanent, you can export this shell variable as an environment variable:

 export $MYDEPT

"Power tends to corrupt, absolute power corrupts absolutely" ~ Lord Acton

Related macOS commands:

set - Set a shell variable
unset - Remove variable or function names

Copyright © SS64.com 1999-2018
Some rights reserved