• We did not send an email asking for donations - please read this post.

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

CrazedNerd

Well-Known Member
Joined
Mar 31, 2021
Messages
833
Reaction score
331
Credits
7,108
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;\[email protected]\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:


osprey

Active Member
Joined
Apr 15, 2022
Messages
285
Reaction score
192
Credits
2,614
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.
 

wizardfromoz

Administrator
Staff member
Gold Supporter
Joined
Apr 30, 2017
Messages
7,835
Reaction score
6,660
Credits
29,046
Now THAT's interesting :)
 
OP
CrazedNerd

CrazedNerd

Well-Known Member
Joined
Mar 31, 2021
Messages
833
Reaction score
331
Credits
7,108
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\]\[email protected]\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$

My prompt string is this:

Code:
wa][033[01

LOL
 

JasKinasis

Well-Known Member
Joined
Apr 25, 2017
Messages
1,572
Reaction score
2,237
Credits
11,629
when i do that:

Code:
PS1=\w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\[email protected]\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!
 
OP
CrazedNerd

CrazedNerd

Well-Known Member
Joined
Mar 31, 2021
Messages
833
Reaction score
331
Credits
7,108
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.
 
$100 Digital Ocean Credit
Get a free VM to test out Linux!

Linux.org Hosting Donations
Consider making a donation

Members online


Latest posts

Top