💻 Software
Why does this bash prompt sometimes keep part of previous commands when scrolling history?
Fresh5 days ago
Mar 15, 202619108 viewsConfidence Score0%
0%
Problem
My bash prompt, which I'll admit to have stolen from a few places and cobbled together, will sometimes add part of previous commands to its length when scrolling the bash history with up/down arrows. For example, if my previous commands were: When I was at my prompt and scrolled up twice it might l…
Error Output
ls cd /home/caleb vim .bashrc
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Canonical Fix
Unverified Fix
New Fix – Awaiting Verification
Fix for: Why does this bash prompt sometimes keep part of previous commands when scrolling history?
Low Risk
The color codes need to be wrapped in square brackets. The brackets inform bash that the enclosed text should not be printed building on @Phreditor's example, this shows that any formatting done after the newline will result in the original issue: w…
Awaiting Verification
Be the first to verify this fix
Sign in to verify this fix