LINUX::EXPORT

Syntax

The syntax is as follows:

export VAR

You can assign value before exporting using the following syntax:
export VAR=value

OR

VAR=value
export VAR

The export command will marks each VAR for automatic export to the environment of subsequently executed commands i.e. make the local shell variable VAR global.

Examples

To make the local shell variable called PATH type the following:

Set a new EDITOR variable:

You need to add export statements to ~/.bash_profile or ~/.profile or /etc/profile file. This will export variables permanently:
$ vi ~/.bash_profile
Sample file

To see all a list of all exported variables and functions, enter:

Sample outputs:

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: