これで、Perlコード行を使用して端末バーのタイトルを変更しています。
print("\e]0;@ARGV\7");
ただし、他のリモートシステムにSSHを接続するたびに、ホストによってヘッダーが変更されます(この点については特に心配しません)。ただし、接続を終了した後も変更されたタイトルがまだ存在します。この問題を解決する方法はありますか?デフォルトでは、ローカルで動作しているときに端末の固定タイトルを持ちたいと思います。
私は主にCentOSやDebianでxfceターミナルとターミネーターを使います。ありがとうございます。
編集する
もう1つの微妙な点は、すべての端末の名前を同じにするよりも、タイトルを即座に自由に編集できますが、編集内容を変更するSSHセッションだけを無効にしたいということです。
ベストアンサー1
回避策:〜/ .bashrcにいくつかの機能を追加して作業を実行してください。後ろにsshおよびsuコマンド
function title()
{
# change the title of the current window or tab
echo -ne "\033]0;$*\007"
}
function ssh()
{
/usr/bin/ssh "$@"
# revert the window title after the ssh command
title $USER@$HOST
}
function su()
{
/bin/su "$@"
# revert the window title after the su command
title $USER@$HOST
}
注:〜/ .bashrcを編集してbashを再起動してください。
例:
# title is "user1@boxA"
ssh boxB # auto changes title while on boxB to "user1@boxB"
exit
# title returns back to "user1@boxA" because of our title call in ssh()
su - user2 # auto changes title while switched user to user2: "user2@boxA"
exit
# title returns back to "user1@boxA" because of our title call in su()
お役に立てば幸いです。