I have customized the shell prompt with the following code in my ~/.bash_profile, but there is one quirk left I can't seem to fix:

export PS1="\u:\[\e[32;1;32m\W\e[m\] \$ "

(code is also on github)

This works well, including for long commands. But if I page through the command history with the arrow keys, the prompt will sometimes get a bit "weird". Sometimes it will include a partial command in the prompt or other times the space after the $ will be disappear. Is there something missing from the code above that I should tweak?



You didn't close the brackets for the first escape, and add the escape for the second

export PS1="\u:\[\e[32;1;32m\]\W\[\e[m\] \$ "
  • Thank you! Was going cross-eyed trying to get it all to work. :) – Rob Oct 27 '11 at 15:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .