Environment Variable
To see a shell’s variables, issue set command or run:
$ printenvThe scope of the variable is the shell in which it’s defined so to make a variable and its value available to other programs, you can enter:
$ export BPVAROr the shortcut for defining and exporting simultaneously is:
$ export BPVAR=3This variable is now called an environment variable because it is available to other programs in the shell’s environment.
Example: To add directories to your shell’s search path temporarily, modify its PATH variable. For example, to append /usr/sbin run:
$ PATH=$PATH:/usr/sbinTo make your change permanent, you should edit bash startup file which is a hidden file in the home directory:
$ vi ~/.bash_profileThen log out and log back in to load the contents.
Labels: Environment Variable, Linux
<< Home