Pergunta

I have configured a PS1 bash prompt.

My ~/.bashrc file:

if [[ $EUID -ne 0 ]]; then
        PS1='\n\e[0;33m☛ \W\e[0m \n\e[1;35m⤷\e[0m '
fi

The problem is that the new line overlaps the previous one. Any idea how to fix this?

Foi útil?

Solução

When using non-printing characters in a bash prompt, you have to specify non-printing sequences (e.g. color codes) as non-printing, using \[...\]:

PS1='\n\[\e[0;33m\]☛ \W\[\e[0m\] \n\[\e[1;35m\]⤷\[\e[0m\] '
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top