The export command is used to make available variables and associated values for other programs called after the export command. When this happens the variable is called an environment variable.
For example, to make available to following programs the variable myVar, with a value of 5, you would do the following:
To verify the variable exists, you can then type
echo $MY_VAR. Note: You cannot put a space before or after the equals sign!
You can append to environment variables. This is useful, for example, when adding more directories to the
$PATH variable. You could append a directory to the
$PATH variable using the export command in the following manner:
Permanent Environment Variables
To make variables permanently available you can put export commands in the
See Current Variables
To see a list of all currently exported variables and functions, use the command:
Some standard environment variables include:
This work is licensed under a Creative Commons Attribution 4.0 International License .