on Ubuntu colored multiline PS1 in bash works wrong with arrow up history
bash, command-prompt, linux, ps1, shell
Solution
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.
Problem
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?