If I scroll up through the history and come across a long line that wraps, then scroll back down, the lines will be scrambled.

I have read around that this can be caused by incorrectly escaping color codes, but this happens even with an empty PS1, e.g.

export PS1=""

In response to comment

echo "[$PROMPT_COMMAND]"
[]
echo "[$PS1]"
[]
有帮助吗?

解决方案

Just press Ctrl+L to refresh the display.

I think the problem is more with Bash not knowing long commands are broken into multiple lines.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top