开发者

change title of xterm from a bash script

开发者 https://www.devze.com 2023-03-16 13:13 出处:网络
I have a script which does a long build. It takes like hours for this script to complete, and while the build is going on there is no way for me to know how much the script has run.

I have a script which does a long build. It takes like hours for this script to complete, and while the build is going on there is no way for me to know how much the script has run. For that I thought of changing the name of the xterm from开发者_开发百科 the script to reflect the subscript.

So, the question is how do I change the xterm title from script ?

I tried adding lines like: echo -e '\033k'$mytitle'\033\' which I got from some other post, but it doesnt work.

Thanks for the help !


There is a program called xtermcontrol which lets you have full control over xterm stuff like that.

If you cannot set the title, perhaps it is locked:

xterm*allowTitleOps: false

You can normally pull up the Font menu (control-right) and check or uncheck the "Allow Title Ops" button to configure this at runtime. Checked allows you to change the title.

Also this program works for me:

#!/bin/bash
#
#

echo -ne "\033]0;$@\007"

Type carefully!


The correct escape for setting xterm title seem to be \033]0; and \007, see http://tldp.org/HOWTO/Xterm-Title-4.html for tips, and http://www.faqs.org/docs/Linux-mini/Xterm-Title.html#ss3.1 for the escape sequence definition.


Take a loo at this post

Set screen-title from shellscript

As per the post you are missing a \ and it should be

echo -e '\033k'$mytitle'\033\\'
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号