I've set PS1 to the following value:
PS1="\033[0;37m[\033[1;33m\w\033[0;37m]\n\t \[[34m\]\u\033[0;37m@\[[34m\]\[[1m\]\h\[(B[m\] $"
The problem is that any command spanning more than a line loops around and don't generate a new line. So I overwrite the line that I already have typed. What is wrong with the PS1?
Answer
Non-printing characters in the prompt need to be surrounded by \[ and \] so that bash can properly track the length of the prompt and accommodate lines that go beyond the edge of the terminal.
No comments:
Post a Comment