Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I got this snippet of code from @mdo (http://markdotto.com) and optimized it to Ubuntu. But now when I type something and erase with backspace, the whole line is erased. I don't know too much of bash and stuff, so you can help me?

PS1='\[\e[0;35m⌘\e[m  \e[0;36m\w/\e[m \e[0;33m`git branch 2> /dev/null | grep -e ^* | sed -E  s/^\\\\\*\ \(.+\)$/\(\\\\\1\)\ /`\e[m\]'

The problem is basically when doing backspaces and erasing entire line.

share|improve this question
add comment

1 Answer 1

I found this one that solves this problem:

export PS1='\[\e[0;35m⌘\e[m \e[0;36m\w/\e[m \e[0;33m`git branch 2> /dev/null | grep -e ^* | sed -E s/^\\\\\*\ \(.+\)$/\(\\\\\1\)\ /`\e[m\] → '

Very convenient for my git work! (Feel free to remove the arrow at the end, seems kinda useless).

Credits go out to this guy: https://gist.github.com/clozed2u/4971506#file-gistfile1-sh

share|improve this answer
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.