Run a local command after closing an SSH connection?
Posted
by
James B
on Super User
See other posts from Super User
or by James B
Published on 2013-10-23T14:41:18Z
Indexed on
2013/10/23
15:58 UTC
Read the original article
Hit count: 299
I've set up my zsh
to update the XTerm title whenever I change directories. It's neat! Unfortunately I have one common problem, which is this:
% cd foo; # title changes to "host1:~/foo"
% ssh host2; # title changes to "host2:~"
% pwd
/home/user/foo # title is still "host2:~"
I need to run some command anytime an ssh connection terminates, either chpwd
, or cd .
, or something similar. I don't think I can use an alias, because I'd need something like
alias ssh=ssh $*; cd .
but AFAICT you can't pick where the arguments go in an alias.
© Super User or respective owner