I know there are many related questions, however I couldn't find any other way to get help on this problem:
On my CentOS VM I made a custom script for my bash prompt in /etc/profile.d/custom.sh
PS1="\n\e[0;97m\][\D{%d%m%y-%H%M}][\u@\h \W] \n\e[m\]\$ "
export PS1
My bash now looks like this:
However If I type a long command and if I want to get the cursor on the first position using CTRL-A this is what happens:
Typed something long. I want to change something at the beginning of the line so I will press CTRL-A to get the cursor at the first position:
After pressing CTRL-A:
Now if I try to delete the whole line with DEL or BACKSPACE this is the end result?
No matter how much I try to delete those 4 chars they always stay until I hit the ENTER key. Those last 4 chars are always displayed but it is like they don't exist.. I am free to type commands and they will be ignored:
At the last picture I successfully executed cd /var
command and now the bash is like it is intended.
Any thoughts?
\[\e
is the first one and\[\e
is near the end of that line? I don't see anywhere else.. – Spirit Jun 06 '15 at 11:52\[
and\]
in pairs. Your originalPS1
had 2 unmatched\]
s. Find the difference carefully. – yaegashi Jun 06 '15 at 12:08