Bash line break problem

Newbie question, I recently changed my PS1 to 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\] \$ " 

But now I get a string wrapper error. I created a gif to explain the problem:

enter image description here

Any ideas what could be wrong?

+8
bash command-prompt macos ps1
source share
2 answers

I think that you specify your evacuation codes twice with [and]. Try the following:

 export PS1="$RESET\ u@ \h:$CYAN\w$YELLOW\$(__git_ps1)$NORMAL \$ " 
+4
source share

A transfer error occurs whenever a non-printable character is not escaped (for example, escape codes that change the color of a tooltip). This also happens when something is set as the locale that the Unicode characters do not understand, and the prompt includes them. An example would be inextricable spaces. When the language is "C" and the invitation contains Unicode characters, the shell believes that more characters are printed than it actually is, and the invitation is prematurely transferred.

0
source share

All Articles