首页 > Linux终端 改变颜色PS1, 有问题

Linux终端 改变颜色PS1, 有问题

就是在.bashrc里面修改PS1如下:

if [ "$color_prompt" = yes ]; then
    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\W\$\[\033[5;36m\] '
fi

会出这个问题,比如:

或者如下:

下面的也会变颜色,本来是绿色的。这个是为什么呢?


原因:
http://askubuntu.com/questions/316842/how-do-i-set-the-prompt-to-use-two-colors
http://www.arwin.net/tech/bash.php

推荐直接上 oh-my-zsh 吧,theme 足够了,这么折腾浪费时间。

【热门文章】
【热门文章】