so here is my setup, I have a ~/.ssh/config
file with this in it
Host staging
HostName staging.bondstreet.com
User ubuntu
Host prod
HostName bondstreet.com
User ubuntu
That way I can ssh by alias (ssh prod / ssh staging / ssh dev) and not use vagrant for ssh.
Then I add this to my .bash_profile
$HOME/themedssh.sh $*
}
alias ssh="themedssh"
and themessh.sh
in $HOME is
function tabc() {
NAME=$1; if [ -z "$NAME" ]; then NAME="Default"; fi
echo -ne "\033]50;SetProfile=$NAME\a"
}
function tabreset() {
NAME="Default"
echo -ne "\033]50;SetProfile=$NAME\a"
}
trap tabreset INT EXIT
if [[ "$1" = "prod" ]]; then
tabc Prod
elif [[ "$1" = "staging" ]]; then
tabc Staging
else
tabc
fi
ssh $*
It selects an iterm2 profile based on the alias name ssh staging
so those are necessary.