【发布时间】:2014-06-30 09:31:47
【问题描述】:
如何在 python 中更改“putty”标题?
在启用 python 时有效:
# python
>>> import sys
>>> sys.stdout.write("\x1b]2;Another Title\x07")
以下内容不起作用:
在py中:
# ./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
回声-e
# echo -e "\x1b]2;Another Title\x07"
打印
# print
-bash: print: command not found
【问题讨论】:
-
如果您指的是未扩展的十六进制代码,我认为这是因为 bash 默认扩展了八进制代码,请尝试
\007。你能解释一下它是怎么不工作的吗? -
太棒了! ;) echo -e "\027Another Title\007"