Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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?

Thanks!

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

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\] \$ "
#---------------------------^^--^^
share|improve this answer
    
Thank you! Was going cross-eyed trying to get it all to work. :) –  Rob Oct 27 '11 at 15:09
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.