1

I am using multiple tabs with "screen" in bash and I have setup the following to rename the tab to the target hostname if I ssh in that tab:

$HOME/.ssh_hostname

#!/bin/sh
echo -ne "\033k$1\033\\"

$HOME/.ssh/config

PermitLocalCommand yes
LocalCommand ~/.ssh_hostname %h

This works great, but the one thing I'd like to do is rename it back to "default" when I exit the ssh session. Right now it just keeps the tab renamed even if I exit ssh.

Any ideas about how I could re-rename it when I exit ssh?

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
user3449833
  • 779
  • 2
  • 10
  • 28
  • 1
    Use a function (or alias) for ssh that sets it back when `ssh` finishes? I don't know that `ssh` can do this for you (but I haven't ever really looked for it either). – Etan Reisner Nov 19 '15 at 16:42
  • Can you put whatever change you want into your `~/.bash_logout` file? – ghoti Nov 19 '15 at 16:49
  • Have you checked http://stackoverflow.com/questions/1687642/set-screen-title-from-shellscript ? – user3159253 Nov 19 '15 at 17:43

0 Answers0