ss64.com似乎是我找到的最佳参考。
它解释了以下变量:
\d The date, in "Weekday Month Date" format (e.g., "Tue May 26").
\h The hostname, up to the first . (e.g. deckard)
\H The hostname. (e.g. deckard.SS64.com)
\j The number of jobs currently managed by the shell.
\l The basename of the shell's terminal device name.
\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 you are not root, inserts a "$"; if you are root, you get a "#" (root uid = 0)
\nnn The character whose ASCII code is the octal value nnn.
\n A newline.
\r A carriage return.
\e An escape character.
\a A bell character.
\\ A backslash.
\[ Begin a sequence of non-printing characters. (like color escape sequences). This
allows bash to calculate word wrapping correctly.
\] End a sequence of non-printing characters.
的 \[ ... \]定义了一系列的非打印字符。他们需要正确跟踪光标位置。
在\e你开始提示转义序列。此处的更多信息(请注意该页面上的“ Esc”是\e顺序)。
- 注意:我从未真正喜欢过转义序列。使用
tput以获得换码为您服务。
${debian_chroot:+($debian_chroot)}是参数扩展。看这里
- 它写
($debian_chroot)if $debian_chroot是否设置,否则不写。