You are not logged in.
When I am using the below prompt, I am having issues with the history scrolling. When I scroll through multiple historical commands, the first 10 characters will sort of stick on the command line, and I will end up seeing half of one command and half of another. The weird thing is that if I hit enter, it will still take the command that is partially on the screen, so it seems to be a problem with only displaying the command.
My Prompt:
PS1='[\e[01;31m\u@\h \w\e[00m]\$ 'Preview:
[root@hostname ~]# For example, here is a list of my recent commands:
[root@hostname ~]# history | tail
201 cd ~
202 nano .bashrc
203 nano .bashrc
204 nano .bashrc
205 exit
206 nano .bashrc
207 export PS1="\e[0;31m[\u@\h \W]\$ \e[m"
208 nano .bashrc
209 exit
210 history | tailI then hit up 5 times, which should go to command 206 in the above output, but it looks like this:
[root@hostname ~]# export PS1="\nano .bashrcIf I hit enter, it opens nano with the .bashrc file with no problem. Also, when I backspace the above command, it will only backspace the nano command, which leaves me with this:
[root@hostname ~]# export PS1="\I'm not sure what is wrong here - any help would be appreciated.
Offline
You should always put "\[...\]" around escape sequences in $PS1:
PS1='[\[\e[01;31m\]\u@\h \w\[\e[0m\]]\$ 'Offline
Thanks for the help - works now. The couple blog posts that I was reading on the topic didn't mention enclosing the escape sequences, but now I know. ![]()
Offline