Characters in PS1 Variable

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? This does not seem to have affected my hint. In fact, my question could further reduce this part: \e]0;

+4
source share
2 answers

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

Everything inside [] :

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

Marked as a non-printable character, so bash can do the right thing with line wrapping, etc. In this case, it means "put the current current address of the user and the current working directory in the title bar." The \a character is a bell character.

+3
source

You can also use the escape sequence for color hint .

0
source

Source: https://habr.com/ru/post/1479673/


All Articles