Why does changing the prompt string to this make the prompt string just a blinking cursor?

C

CrazedNerd

Guest
I'm trying to understand my elaborate prompt string in Ubuntu...to test things, i copied and pasted this, and then assigned it to PS1:

Code:
PS1='\[\e]0;\u@\h: '

The result is now that the prompt string is just a blinking cursor, and even though the things i type get put into the terminal, i can't see them! This is so strange, why is it
behaving like this? At first I thought it was just a completion prompt, but when i do this, i can still enter commands and they behave normally.
 
Last edited by a moderator:


The 0 that the escape character is escaping in your code means "reset all attributes to normal mode", which basically leaves the prompt in the default expression, which is the blinking cursor.
 
Now THAT's interesting :)
 
Damn right, one thing i havent tested is the rest of the string without the first bit...
when i do that:

Code:
PS1=\w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$

My prompt string is this:

Code:
wa][033[01

LOL
 
when i do that:

Code:
PS1=\w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$

My prompt string is this:

Code:
wa][033[01

LOL

Try enclosing that format string in quotes!
E.g.
Bash:
PS1="YourFormatString"
Sorry, I’m on my ancient phone right now. Couldn’t be arsed to mess with trying to copy/paste the original format string! Ha ha!

I haven’t studied your original format string in detail, but enclosing it in quotes might yield a slightly different result!
 
Try enclosing that format string in quotes!
E.g.
Bash:
PS1="YourFormatString"
Sorry, I’m on my ancient phone right now. Couldn’t be arsed to mess with trying to copy/paste the original format string! Ha ha!

I haven’t studied your original format string in detail, but enclosing it in quotes might yield a slightly different result!
No, ive already tried it multiple times with single and double quotes, it does the same thing. Im pretty sure i did it with the second one too.
 
Maybe not exactly what you're after, but this works:
Code:
[flip@flop ~]$ PS1="\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$"
flip@flop:~$cd newdir
flip@flop:~/newdir$
On the last line the "flip@flop" is green, and "~/newdir" is magenta/purple.
 

Members online


Top