bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Trouble with PS1 special characters between \[ and \]


From: Lluís Batlle i Rossell
Subject: Trouble with PS1 special characters between \[ and \]
Date: Sat, 30 Oct 2010 23:13:25 +0200
User-agent: Mutt/1.5.20 (2009-06-14)

Hello,

I don't think this problem is related to any recent bash version only. I've seen
this since years I think.

Nevertheless I'm using GNU bash, version 4.0.17(1)-release
(x86_64-unknown-linux-gnu) now.

My PS1 uses the "Change window title" sequence, to set the xterm window title to
something close to the prompt text. Hence my PS1 is:

PS1='\[\033]2;\h:\u:\w\007\]\n\[\033[1;31m\][\u@\h:\w]\$\[\033[0m\] '

The ESC ] 2;.....BEL command, which has \h, \u and \w sequences in the middle,
has problems on the length of the printable part of the prompt, as those usual
when typing terminal control sequences without \[ \]. With the difference that I
typed all the \[ \].

May bash be having trouble, if it finds any of its own special backslash
characters (\h, \u, \w) in the middle of a non-printable sequence marked with \[
and \] ?

Regards,
Lluís.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]