Read the man page
of the program you are trying to influence with an environment variable. For PROMPT_COMMAND
it's man bash
. Since programs generally use all upper case environment variables, and environment variables are passed to programs as strings, (in the env
array, along with the argv
array) and accessed by name, you can generate a list including all the environment variables looked at by a program via (change bash
to the program you're interested in):
strings $(type -p bash) | egrep '^[A-Z0-9]+$'
Or replace the $(type -p bash)
with the actual path to the binary.
User setting of environment variables is usually done in ~/.bashrc
, or in a file called by ~/.bashrc
, like this:
export LESS="-XMersj3"
This sets my default options for less
(See man less
).
After a change to ~/.bashrc
, you must source the file (via . ~/.bashrc
) to populate your environment with the updated definitions. Logging out/in also re-sources ~/.bashrc
, BUT if you've broken ~/.bashrc
, you may have trouble logging in.