Say I have this as my PS1

PS1='\[\e]0;TITLE\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n\$ '

it will give me this prompt

Steven@Steven-PC ~
$

with a window title as TITLE

I understand that this part

\e]0;TITLE\a

creates the title, but I dont understand why. It just seems like some gibberish.

有帮助吗?

解决方案

The terminal driver looks for output containing that specific code (\e]0;)and uses everything up to the \a as the terminal window title.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top