Why does this PS1 value cause unexpected behaviour?

view story

http://unix.stackexchange.com – I have set my PS1 variable in .bashrc to be the following: PS1='\e[35m[\W]:\e[0m ' It achieved what it was intended to (change the color of the prompt which displays cwd inside [] 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- (HowTos)