#!/bin/bash## ssh into a machine and automatically set the background# color of Mac OS X Terminal depending on the hostname.## Installation:# 1. Save this script to /some/bin/ssh-host-color# 2. chmod 755 /some/bin/ssh-host-color# 3. alias ssh=/some/bin/ssh-host-color# 4. Configure your host colors below.set_term_bgcolor(){localR=$1localG=$2localB=$3/usr/bin/osascript<<EOFtell application "Terminal" tell window 0 set the background color to {$(($R*65535/255)), $(($G*65535/255)), $(($B*65535/255)), 32767} end tellend tellEOF}set_term_profile(){localprofile=$1/usr/bin/osascript-e"tell application "Terminal" to set current settings of first window to settings set "$profile""}# Host-specific background colors.if[["$@"=~production1.com]];thenset_term_profile"HomeBrew"elif[["$@"=~production2.com]];thenset_term_bgcolor0400fissh$@# Default background color.set_term_profile"Pro"
set term profileでプロファイルの名前を渡せばそれに切り替わる。
set bg colorも残してる。