The value of the variable PROMPT_COMMAND is examined just before Bash prints each primary prompt. If PROMPT_COMMAND is set and has a non-null value, then the value is executed just as if it had been typed on the command line.
In addition, the following table describes the special characters which can appear in the prompt variables:
\a
\d
\D{
format}
strftime
(3) and the result is inserted
into the prompt string; an empty format results in a locale-specific
time representation. The braces are required.
\e
\h
\H
\j
\l
\n
\r
\s
$0
(the portion
following the final slash).
\t
\T
\@
\A
\u
\v
\V
\w
\W
\!
\#
\$
#
, otherwise $
.
\
nnn\\
\[
\]
The command number and the history number are usually different: the history number of a command is its position in the history list, which may include commands restored from the history file (see Bash History Facilities), while the command number is the position in the sequence of commands executed during the current shell session.
After the string is decoded, it is expanded via
parameter expansion, command substitution, arithmetic
expansion, and quote removal, subject to the value of the
promptvars
shell option (see Bash Builtins).