linux 101 hacks 6 (PROMPT_COMMAND)

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
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值