|
|
Variables stored in the environment are visible to you within the shell; but variables you set within your shell session are not accessible to other programs running in the environment until you make them so by explicitly exporting them.
To export a shell variable to the environment, use the export command. For example, in the Bourne and Korn shells:
$In the Korn shell, the following alternative form exists:FOO=bar
$export FOO
$ export FOO=bar
In the C shell:
% setenv FOO bar
This will cause the variable FOO to be exported to any
processes started from within the current shell.
You can export more than one variable at a time with the export command by listing a set of variable names to be exported. (There may already be an export command in your startup file. In this case, add the name of the additional variable to the end of the list of variables for export.) For example:
. . . # PATH=/bin:/usr/bin:/u/bin:/usr/local/bin:/local/bin:${HOME}/bin: LOGNAME=charles MAIL=${HOME}/.mailbox . . . export PATH LOGNAME ... . . .