Run a local command after closing an SSH connection?
- by James B
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.