本文介绍了Bash提示符换行问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
新手问题,我最近改变了我的PS1到这一点:
Newbie question, I recently changed my PS1 into this:
RESET="\[\017\]"
NORMAL="\[\033[0m\]"
YELLOW="\[\033[0;33m\]"
CYAN="\[\033[0;36m\]"
export PS1="\[$RESET\]\u@\h:\[$CYAN\]\w\[$YELLOW\]\$(__git_ps1)\[$NORMAL\] \$ "
但现在我得到一个换行错误。我创建了一个GIF来解释这个问题:
But now I get a line wrapping error. I created a gif to explain the problem:
任何想法可能是错误的?
Any ideas what might be wrong?
推荐答案
我觉得你的双引号逃生codeS用[和]。试试这个:
I think you're double-quoting your escape codes with [ and ]. Try this one:
export PS1="$RESET\u@\h:$CYAN\w$YELLOW\$(__git_ps1)$NORMAL \$ "
这篇关于Bash提示符换行问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!