LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   How to fix prompt in terminal (https://www.linuxquestions.org/questions/linux-software-2/how-to-fix-prompt-in-terminal-4175602215/)

BW-userx 03-20-2017 02:37 PM

How to fix prompt in terminal
 
what you see here is if I up arrow and back off on text the cursor block backs up over top of the $ not stopping before it.
Code:

userx@slackwhere⚡️~⚡️$ rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrwwewewe
bash: rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrwwewewe: command not found
userx@slackwhere⚡️~

Code:

export PS1="\\[\e[36m\]\u\[\e[31m\]@\[\e[37m\]\h\\[⚡️\]\[\e[34m\]\w\\[\e[m\]\[⚡️\]\$ "
at times it will wrap and type over top of text already written, even in nano it messes up the text while typing. half of the text will look like it is not there when it is and such craziness I find hard to put into words.

I already ran this
Code:

shopt -s checkwinsize

hydrurga 03-21-2017 07:51 AM

I don't know if this helps or not, BW, but you appear to have an unnecessary \ right at the beginning of the string.

Also, given that ⚡️ is a printable character, it doesn't need to be in a non-printable escape sequence.

There is also an extra \ after the \h and before your unneeded non-printable escape sequence.

So:

Code:

"\[\e[36m\]\u\[\e[31m\]@\[\e[37m\]\h⚡️\[\e[34m\]\w\\[\e[m\]⚡️\$ "

BW-userx 03-21-2017 10:34 AM

Quote:

Originally Posted by hydrurga (Post 5686350)
I don't know if this helps or not, BW, but you appear to have an unnecessary \ right at the beginning of the string.

Also, given that ⚡️ is a printable character, it doesn't need to be in a non-printable escape sequence.

There is also an extra \ after the \h and before your unneeded non-printable escape sequence.

So:

Code:

"\[\e[36m\]\u\[\e[31m\]@\[\e[37m\]\h⚡️\[\e[34m\]\w\\[\e[m\]⚡️\$ "

I broke it down to this
Code:

export PS1="\\[\e[36m\]\u\[\e[31m\]@\[\e[37m\]\h:\[\e[34m\]\w\[\e[m\]\[⚡️\]\$ "
- that extra \ at the begning is from some how to page on this - I'll copy paste yours and see what happens.
Thanks.


All times are GMT -5. The time now is 04:59 AM.