1

I am not exactly a pro at BASH Scripting, but I can get by with the basics. I use MRXVT with Cygwin on my windows box (MRXVT is an RXVT Terminal with tabs. RXVT is a Standard Cygwin terminal, but with enhanced features). I found a command to change the tab names for MRXVT:

echo -ne "\e]62;New tab title\a"

It works like a charm. I'm not, however, interested in A)Changing it manually or B)Changing it to a static String

I use a lot of SSH. I'd like the tab title to be username@host[current directory] at any given time.

I'm not sure if I'm supposed to use a trap for this. Frankly, I don't understand how traps work. I guess I could create an ssh alias that pulls the first argument of the ssh command and sets the tab title to that...This would be sufficient, but not preferred.

Do you guys have any ideas?

4

1 回答 1

1

找到了答案。添加

trap 'echo -ne "\e]62;mrxvt: $USER@${HOSTNAME}\007"' DEBUG

到我的 .bashrc 的最后。我决定我不喜欢在我的标签(或标题栏)中有路径。此外,由于我编写了 AHK 脚本,我不得不在字符串的开头添加“mrxvt:”;否则它将无法正常工作。对此的完整答案是:

trap 'echo -ne "\e]62;$USER@${HOSTNAME}[${pwd}]\007"' DEBUG

同样,只需将该行添加到 .bashrc 的末尾,就可以了。

希望这对其他人有帮助:)

于 2011-12-14T18:51:04.857 回答