Pergunta

I have next line in .bashrc:

PS1="\e[0;32m[ \w ]\n#\e[m "

to set very simple welcome line of green color. On Ubuntu using arrow up/down to load previous commands puts extra symbols to the command line:

[ /tmp ]
# echo "hello there"
hello there
[ /tmp ]
# echecho "hello there"

Notice ech symbols in front of last command. These symbols can't be edited -- cursor doesn't go there.

What I did wrong?

Foi útil?

Solução

You need to escape the characters that are not displayed. Change the line in .bashrc to the following:

PS1="\[\e[0;32m\][ \w ]\n#\[\e[m\] "

Run source ~/.bashrc to apply the changes.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top