If set, the value is executed as a command prior to issuing each primary
Note: Environment variables vs shell variables
PROMPT_COMMAND is not an environment variable. It's just a shell variable.
Both types of variables are accessed the same way (
"$variable*"), but environment variables are inherited by child processes whereas shell variables aren't.
The convention is to capitalize environment variables + shell variables that configure your shell (PROMPT_COMMAND does configure your shell), but keep other types of variables lower case.
In bash, you can do:
declare -p to find out whether a variable is exported (=is an environment variable) or not:
$ declare -p PATH
declare -x PATH=... #-x means it's exported
$ declare PROMPT_COMMAND
declare -- PROMPT_COMMAND=... #no -x so just a shell variable