Bash PS1 window title?

萝らか妹 提交于 2020-11-29 09:29:06

问题


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.


回答1:


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



来源:https://stackoverflow.com/questions/10456228/bash-ps1-window-title

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!