Go to the first, previous, next, last section, table of contents.


Controlling the Prompt

The value of the variable PROMPT_COMMAND is examined just before Bash prints each primary prompt. If it is set and non-null, 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
A bell character.
\d
The date, in "Weekday Month Date" format (e.g., "Tue May 26").
\e
An escape character.
\h
The hostname, up to the first `.'.
\H
The hostname.
\n
A newline.
\r
A carriage return.
\s
The name of the shell, the basename of $0 (the portion following the final slash).
\t
The time, in 24-hour HH:MM:SS format.
\T
The time, in 12-hour HH:MM:SS format.
\@
The time, in 12-hour am/pm format.
\u
The username of the current user.
\v
The version of Bash (e.g., 2.00)
\V
The release of Bash, version + patchlevel (e.g., 2.00.0)
\w
The current working directory.
\W
The basename of $PWD.
\!
The history number of this command.
\#
The command number of this command.
\$
If the effective uid is 0, #, otherwise $.
\nnn
The character whose ASCII code is the octal value nnn.
\\
A backslash.
\[
Begin a sequence of non-printing characters. This could be used to embed a terminal control sequence into the prompt.
\]
End a sequence of non-printing characters.


Go to the first, previous, next, last section, table of contents.