1:PS1 - Default Interaction Prompt
export PS1="\u@\h \w> " \u用户名,\h 主机名 \w 当前路径 , 如在home目录下,则显示~
\t 时间 , \@ 12小时形式的时间 $kernel_version kernel 版本号,
2:PS2 - Continuation Interactive Prompt
命令太长了,你要换一行输入的话就要用这个 \ ,写在行尾,然后enter后默认提示为 >(这就是ps2)
export PS2="continue-> " 可以改变 为 continue->
3:PS3 - Prompt used by “select” inside shell script
4:PS4 - Used by “set -x” to prefix tracing output
在shell的debug模式下(set -x 进入debug),的提示
o $0 - indicates the name of script
o $LINENO - displays the current line number within the script
5:PROMPT_COMMAND
shell 在显示ps1以后,就会执行 PROMPT_COMMAND.
6:改变ps1的提示颜色
$ export PS1="\e[0;34m\u@\h \w> \e[m "
\e[ 彩色提示 开始
x;ym 颜色值
\e[m 彩色提示 结束
颜色表如下:
Black 0;30
Blue 0;34
Green 0;32
Cyan 0;36
Red 0;31
Purple 0;35
Brown 0;33
7:改变提示的背景颜色
\e[{code}m \e[m code:40-47
export PS1="\u@\h \w> " \u用户名,\h 主机名 \w 当前路径 , 如在home目录下,则显示~
\t 时间 , \@ 12小时形式的时间 $kernel_version kernel 版本号,
2:PS2 - Continuation Interactive Prompt
命令太长了,你要换一行输入的话就要用这个 \ ,写在行尾,然后enter后默认提示为 >(这就是ps2)
export PS2="continue-> " 可以改变 为 continue->
3:PS3 - Prompt used by “select” inside shell script
4:PS4 - Used by “set -x” to prefix tracing output
在shell的debug模式下(set -x 进入debug),的提示
o $0 - indicates the name of script
o $LINENO - displays the current line number within the script
5:PROMPT_COMMAND
shell 在显示ps1以后,就会执行 PROMPT_COMMAND.
6:改变ps1的提示颜色
$ export PS1="\e[0;34m\u@\h \w> \e[m "
\e[ 彩色提示 开始
x;ym 颜色值
\e[m 彩色提示 结束
颜色表如下:
Black 0;30
Blue 0;34
Green 0;32
Cyan 0;36
Red 0;31
Purple 0;35
Brown 0;33
7:改变提示的背景颜色
\e[{code}m \e[m code:40-47