What's wrong with this bash prompt?

Posted by takeshin on Server Fault See other posts from Server Fault or by takeshin
Published on 2010-06-04T14:40:54Z Indexed on 2010/06/07 6:23 UTC
Read the original article Hit count: 490

Filed under:
|
|
|
|

I use the following entry in ~/.bashrc file to colorize the prompt and display current branch of git repository:

PS1='\[\e[1;32m\]\[\u@\h\]\[\e[m\] \[\w\]\[\e[1;1m\]\[$(__git_ps1 " (%s)")\] \[\e[1;1m\]\[$\] \[\e[m\]'

This works almost fine, except when I use bash history (up arrow key few times), the command line becomes 'outdented' (just the first characters of the prompt remains untouched), and the visible is:

usemmand

when my username is user and the command is command.

© Server Fault or respective owner

Related posts about bash

Related posts about command-line