Bash command prompt overwrites the current line

3

2

My bash command prompt is:

\e[32;1m[\e[m\h.\u \e[33;1m\W\e[m\e[32;1m]\e[0;36m::\e[m

There must be something wrong with it, because on long lines, the current line is overwritten, instead of continuing on the next line.

I'm using OSX and bash 3.2.48

cfischer

Posted 2011-02-16T17:19:50.357

Reputation: 7 733

Answers

5

Every non printable sequence of characters must be enclosed between \[ and \]:

'\[\e[32;1m\][\[\e[m\]\h.\u \[\e[33;1m\]\W\[\e[m\e[32;1m\]]\[\e[0;36m\]::\[\e[m\]'

cYrus

Posted 2011-02-16T17:19:50.357

Reputation: 18 102