3

I customized my bash prompt, PS1 value.

~/.bashrc:

Color_Off='\e[0m'       # Text Reset
BGreen='\e[1;32m'       # Green
BPurple='\e[1;35m'      # Purple
BWhite='\e[1;37m'       # White
BIBlue='\e[1;94m'       # Blue
PS1="[\[$BGreen\w\]\[$Color_Off\]]\n[\[$BPurple\u\]\[$BWhite\]@\[$BIBlue\h\]\[$Color_Off\]]\$ "

When I scroll up in the history with up arrow from the keyboard, after a lot of command I can see these:

[/etc]
[bicocca@bicoccag]$ vi
[/etc]
[bicocca@bicoccag]$ vim
[/etc]
[bicoclear

The command overlaps the prompt. How I can resolve the issue? I tried to search in Google but I did not found anything.

I am using RHEL6.4.

Anthon
  • 79,293
  • As a side note, I would suggest having the Prompt Escape Sequences (\w,\n,\u, etc) to the right of the closing \] for the color sequence. More over, if you are going to use vars for your colors, add the brackets to the var (`BGreen='[\e[1;32m]'), much cleaner. – demure Jun 09 '13 at 02:46

0 Answers0