How to stop bash prompt colours from escaping

view full story

http://askubuntu.com – I'm trying to configure bash to display the current git branch, based off the example here, but I can't figure out how to get bash to stop escaping the colour strings. Everything I try results in the colour strings being outputted in the prompt line. My prompt looks like this: valorin@gandalf:~/workspace/wyoa (\[\033[0;31m\]master\[\033[00m\])$ The relevant section in .bashrc: ## # Custom Git Branch name in prompt ## function git_prompt { if ! git rev-parse --git-dir > /dev/null 2>&1; then return 0 fi git_branch=$(git branch 2>/dev/null| sed -n '/^\*/s/^ (HowTos)