Skip to content

Latest commit

 

History

History
23 lines (14 loc) · 535 Bytes

SC2025.md

File metadata and controls

23 lines (14 loc) · 535 Bytes

Pattern: Ambiguous Bash prompt

Issue: -

Description

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\]'

Further Reading