I want to customize my bash prompt using ANSI escape codes and have noticed that in some howtos the codes are enclosed in \[
and \]
while in others they aren't.
For example, these work equally well for me:
PS1='\e[0;32m foo '
PS1='\[\e[0;32m\] foo '
I wonder what difference does it make?