It's hard to answer that question completel and accurately, because the point of doing export
is to put a name/value pair (EDITOR=nano
for example) into the information inherited by a child process of the exporting shell.
In general, you want to export things you set in .bashrc
: EDITOR
is a great example because that sets your preference for text editors that mailers, database interfaces and many other programs use to decide what program to run when one of those programs wants you to edit some text. I use EDITOR=vi
myself. Other common examples from .bashrc
are ORACLE_HOME
, PATH
, VISUAL
, TERM
and SHELL
. I got those by doing man more
, and reading down to the ENVIRONMENT section.
Now that I've written "in general", I have to note that other than EDITOR
and VISUAL
, environment values are many, varied and specific to some subsystem. Doing anything with the notorious Oracle database system requires lots of extra environment values, a lot of it by superstition. Because the shell's environment is a set of name/value pairs, the environment is used by individual systems in all kinds of different ways. Apache web server passes a lot of values to CGI-BIN
programs in the environment.
My advice is to export as few variables as possible. Don't pollute your interactive environment, as you can never tell when some program will decide to use your secret environment variable's value. Write small shell scripts that do little more than set environment variables then run the program that expects those variables.
If you have a large number of environment variables set for your interactive environment, you will be surprised if you try to run something from cron
- crond
will not set the environment correctly, and you will have no idea of why.