FG
šŸ’» Software

How to fix my bash prompt with long lines?

Fresh7 days ago
Mar 15, 20262591 views
Confidence Score0%
0%

Problem

I have the following bash prompt: It looks like this: Which is what I want. However, when I enter a long line, it does not break the line at all but rather overwrites the current one from the beginning of the line. When this happens and I hit backspace, everything in that line will disappear. How c…

Error Output

YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"
RESET='\e[0m'

export PS1="$GREEN[\W]$YELLOW \$(__git_ps1 \"(%s) \")$RESET\\$ "

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: How to fix my bash prompt with long lines?

Low Risk

You forgot to wrap the value of . Bash must know how long the prompt is in order for word-wrap to work correctly, and everything not between and is counted.

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment