Pattern: Ambiguous Bash prompt
Issue: -
Bash is unable to determine exactly which parts of your prompt are text and which are terminal codes. You have to help it by wrapping invisible control codes in \[..\]
(and ensuring that visible characters are not wrapped in \[..\]
).
Example of incorrect code:
PS1='\e[36m\$ \e(B\e[m'
Example of correct code:
PS1='\[\e[36m\]\$ \[\e(B\e[m\]'