Why is my bash prompt getting bugged when I browse the history?
I have set my
PS1 variable in
.bashrc to be the following:
It achieved what it was intended to (change the color of the prompt which displays
 and before
:), but when I search through my command history, sometimes parts of commands that I cycle over become attached to the prompt. For example:
[~]: echo "something" something [~]: date Sun Nov 18 17:07:54 PST 2012 [~]: sudo apt-get install vim ...
Now, say I want to return to my
echo "something" command, I press up and get
[~]: sudo apt-get install vim
I press up again and this happens
[~]: sudo apt-date
[~]: sudo apt-echo "something"
and if I delete everything on the command line by pressing backspace, it deletes all the way back to
[~]: sudo apt-
It has no affect on the command. For example, the line
[~]: sudo apt-date will still print the output of
date etc. Why is this happening and how can I achieve the desired prompt without the side effects?