Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have a weird issue where my Bash prompt often completely disappears on a backspace. Doesn't make any sense to me, but it happens often:

enter image description here enter image description here

I can't really think of why this is happening. Am I overlooking some configuration file or something?

Here's my PS1 prompt:

PS1='\[\e]2;\u@\h\a\u@\h \W \$ '
share|improve this question
2  
It would help if you posted your $PS1. Otherwise my blind guess is you may not have it wrapped in \[ \]. –  jw013 Oct 6 '11 at 21:17
    
Posted: PS1='\[\e]2;\u@\h\a\u@\h \w \$ ' –  Naftuli Tzvi Kay Oct 6 '11 at 23:04
    
I can reproduce the problem with that PS1. Type a few characters, backspace over them and whoosh, there it goes. –  Paul Tomblin Oct 7 '11 at 0:20
    
What does that PS1 accomplish that PS1='\u@\h \W \$' doesn't? –  Paul Tomblin Oct 7 '11 at 0:22
    
Writing username@host into the actual shell title. –  Naftuli Tzvi Kay Oct 7 '11 at 0:33
show 2 more comments

2 Answers 2

up vote 8 down vote accepted

As I suspected in my comment, you are missing a \] in your PS1. Try this one:

PS1='\[\e]2;\u@\h\a\]\u@\h \W \$ '

For comparison, the original is

PS1='\[\e]2;\u@\h\a\u@\h \W \$ '
#                  ^ missing \]
share|improve this answer
    
That fixes it, thanks! –  Naftuli Tzvi Kay Oct 7 '11 at 4:04
add comment

Check if something running is blanking your PS1 env variable.
As an example on another machine not affected by that problem if you run

PS1=""

in a bash shell you will get the same output of your screen-shots.

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.