解決策:いくつかの関数〜/ .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()
お役に立てば幸いです。