改变redhat中的标题,bash

时间:2014-06-30 09:31:47

标签: python bash putty

如何更改python中的“putty”标题?

启用python时它可以工作:

# python
>>> import sys
>>> sys.stdout.write("\x1b]2;Another Title\x07")

以下不起作用:

py中的

# ./myscript

的MyScript:

#!/usr/bin/python
import sys
sys.stdout.write("\x1b]2;Another Title\x07")

回波

# echo "\x1b]2;Another Title\x07"
\x1b]2;Another Title\x07

echo -e

# echo -e "\x1b]2;Another Title\x07"

打印

# print
-bash: print: command not found

2 个答案:

答案 0 :(得分:1)

Jidder谢谢,

解决方案:  echo -e" \ 027另一个标题\ 007"

答案 1 :(得分:-1)

http://the.earth.li/~sgtatham/putty/0.63/htmldoc/Chapter4.html#config-title

  

PuTTY允许服务器发送xterm个控制序列,在会话中段修改窗口的标题。

http://www.tldp.org/HOWTO/text/Xterm-Title

  

3.1。 xterm转义序列

     

通过使用,可以在正在运行的xterm中更改窗口和图标标题    XTerm转义序列。以下序列在此有用    方面:

     
      
  • ESC]0;stringBEL - 将图标名称和窗口标题设置为字符串
  •   
  • ESC]1;stringBEL - 将图标名称设置为字符串
  •   
  • ESC]2;stringBEL - 将窗口标题设置为字符串

         

    其中ESC是转义字符(\033),而BEL是铃声   字符(\007)。

  •   

这意味着你想要的是:

$ printf "\033]0;My shiny new title\007"

PS:不要使用echo选项(-n / -e,它不可移植)。

相关问题