Bash problem Mac OS Terminal Hi when I pressed the up arrow to see the previous command, it rewrote the current command from half.

Example:

21 /usr/local/sphinx/etc &gt;  /usr/local/sphinx/bin/search --config /usr/local/sphinx/etc/sphinx-blog.conf php


and when I press the up arrow, it shows:

21 /usr/local/sphinx/etc &gt;  /usr/local/sudo /usr/local/sphinx/bin/indexer --config /usr/local/sphinx/etc/sphinx-blog.conf --all


and "/usr/local/" before SUDO is from previous command. Do you know where the problem would be? Here is my prompt setting:

PS1="\# \e[32;1m\w &gt; \e[0m "
I tried around and finally managed to find the error: you need to use even more escape sequences in your PS1 - this should work:

export PS1="\# \[\e[32;1m\]\w &gt; \[\e[0m\]"


note the additional \[ and \] that wrap the colour escape sequences.