gnu screen: can you automatically name a window after the last invoked program?

寵の児 提交于 2020-01-22 12:33:05

问题


Is there a way to automatically have each window change its name to the name of the last program you ran from that window?

This would be more convenient than having to rename the windows manually.


回答1:


Yes, you can use shelltitle to do this.

Assuming you use bash, the following should work. Add this to your .screenrc:

shelltitle "$ |bash"

where the "$ " should match whatever is at the end of your prompt string ($PS1) and "bash" is the default title. Then add a null title escape sequence to the beginning of your prompt string:

export PS1='\[\033k\033\\\]'$PS1

which should go in your .profile or whatever.



来源:https://stackoverflow.com/questions/2068806/gnu-screen-can-you-automatically-name-a-window-after-the-last-invoked-program

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