💻 Software
Linux: coloring bash prompt will break carriage return
Fresh7 days ago
Mar 15, 202612143 viewsConfidence Score0%
0%
Problem
When I try to colorize the prompt like this: it breaks the carriage return (instead of going to a new line when line is full, it starts in the same line and erases the input text). If I remove the color sequence it works fine. I use Ubuntu 11.10 and terminal (guake has the same bug too).
Error Output
export PS1="\e[0;31m[\u@\h \W]\$ \e[m "
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Canonical Fix
Unverified Fix
New Fix – Awaiting Verification
Fix for: Linux: coloring bash prompt will break carriage return
Low Risk
You must wrap all escape sequences between and in order for 'readline' to correctly calculate the prompt's visible length. Without them, 'readline' thinks the prompt is longer than it is, and doesn't know when the text reaches the margin.
Awaiting Verification
Be the first to verify this fix
Sign in to verify this fix