#!/bin/sh
#
# ssh into a machine and automatically set the background
# color of Mac OS X Terminal depending on the hostname.
HOSTNAME=`echo $@ | sed s/.*@//`
set_bg () {
local OPACITY=0.2
osascript -e "tell application \"Terminal\" to set background color of window 1 to $1"
}
on_exit () {
set_bg "{0, 0, 0, 50000}"
set transparency to 0
}
trap on_exit EXIT
if [[ "$@" =~ prod ]]; then
# all production
set_bg "{26214, 0, 0, 50000}"
elif [[ "$@" =~ dev ]]; then
# development
set_bg "{11565, 0, 19789, 50000}"
elif [[ "$@" =~ jaguar ]]; then
set_bg "{4369, 4369, 19789, 50000}"
fi
/usr/bin/ssh "$@"