Bash prompt line wrapping issue

Newbie question, I recently changed my PS1 into this:

RESET="[17]"
NORMAL="[33[0m]"
YELLOW="[33[0;33m]"
CYAN="[33[0;36m]"

export PS1="[$RESET]u@h:[$CYAN]w[$YELLOW]$(__git_ps1)[$NORMAL] $ "

But now I get a line wrapping error. I created a gif to explain the problem:

在这里输入图像描述

Any ideas what might be wrong?


I think you're double-quoting your escape codes with [ and ]. Try this one:

export PS1="$RESETu@h:$CYANw$YELLOW$(__git_ps1)$NORMAL $ "
链接地址: http://www.djcxy.com/p/73968.html

上一篇: Scala.js vs Scala GWT用于客户端Web开发?

下一篇: Bash提示行换行问题