PS1 modified lags code example
Example: PS1 modified lags
The string property is not properly closed by default
You have to add a layer of closure by adding unprintable brackeys
Example 1 : We want Hello World in green as our prompt
Without brackeys:
PS1="\033[1;32m Hello World \033[00m"
With brackeys (no text-wrapping):
PS1="\[ \033[1;32m \] Hello World \[ \033[00m \]"
Example 2 : My prompt
PS1="\[\033[1;32m\]\u@\h\[\033[00m\] [ \[\033[38;5;215m\]\[\e[5m\]\w\[\e[25m\]\[\033[00m\] ] "
Ressource for colours and effects :
"https://misc.flogisoft.com/bash/tip_colors_and_formatting"