Frage

My PS1 variable :

\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\u@\h:\w\$

I understand everything except the first part \[\e]0;\u@\h: \w\a\]. What is the purpose of this part? It doesn't seem to affect my prompt. In fact my question could be reduce even more to this part : \e]0;

War es hilfreich?

Lösung

Escape ]0 (the \e]0 you're interested in) modifies an XTerm title bar. More at this link: http://www.tldp.org/HOWTO/Bash-Prompt-HOWTO/xterm-title-bar-manipulations.html

Everything inside the []:

\[\e]0;\u@\h: \w\a\]

Is marked as a non-printing character, so bash can do the right thing with line wrapping, etc. In this case that means "put the current user@hostname and current working directory in the title bar". The \a is a bell character.

Andere Tipps

You can also use the escape sequence to color your prompt.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top