I'm on OS X and am using iTerm2.
I've updated my Bash profile on several of my servers so that when I ssh
into them I can tell at a glance from the tabs what boxes I'm on. When I exit from an ssh
session, the shell that initiated the ssh
session does not source ~/.bashrc
again (which I understand to be normal operating procedure), so my tab titles and colors persist with the titles and colors they were from my ssh
session.
Normally when I exit an ssh
session, I will also exit the shell on the computer that I'm physically using as well. But for consistency's sake, I would like to revert my iterm2 tabs to the appropriate titles and colors for the shell they represent when I exit an ssh
session.
Is there a way to source my .bashrc
when I exit an ssh
session?
In all of ~/.bash_profile
, ~/.bashrc
, and ~/.bash_logout
I have the following lines:
export PROMPT_COMMAND=''
echo -e "\033];test machine name\007"
When I exit an ssh
session, it looks like none of these Bash files in my home directory are sourced to reprint the tab title. When I manually source them with source ~/.bashrc
the tab title reprints just fine. So, the syntax is not wrong.
~/.bash_logout
.