从shellscript里设置屏幕标题 [英] Set screen-title from shellscript
问题描述
是否有可能使用shell脚本设置丝网标题
?
Is it possible to set the Screen-Title
using a shell script?
我想过像发送键命令 STRG + A移位-A名称<输入>
我搜索了关于如何在shell脚本模拟按键一个小时,但并没有找到答案。
I searched for about an hour on how to emulate keystrokes in an shell script, but didn't find the answer.
感谢您的帮助!
Beerweasle
Beerweasle
推荐答案
您可以通过以下行设置屏幕/ xterm的标题:
You can set the screen / xterm title using the following lines:
#!/bin/bash
mytitle="Some title"
echo -e '\033k'$mytitle'\033\\'
[更新] - 根据要求,我还包括下面提出@Espo解决方案:
[UPDATE] - by request I'm also including the solution proposed by @Espo below:
根据您的xterm版本或你的Linux发行上面的行可能会或可能无法正常工作,您可以尝试在xterm-默认值:
Depending on your xterm version or your linux distribution the line above may or may not work and you can try the xterm-defaults:
#!/bin/bash
mytitle="Some title"
echo -e '\033]2;'$mytitle'\007'
有关更多的详情,请参见:<一href=\"http://www.faqs.org/docs/Linux-mini/Xterm-Title.html#s3\">http://www.faqs.org/docs/Linux-mini/Xterm-Title.html#s3或者参考答案由@Espo下面。
For more on the details see: http://www.faqs.org/docs/Linux-mini/Xterm-Title.html#s3 or refer to the answer by @Espo below.
这篇关于从shellscript里设置屏幕标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!