Skip to content

Instantly share code, notes, and snippets.

@locriani
Last active March 9, 2017 22:24
Show Gist options
  • Select an option

  • Save locriani/a11204e6d934f340da06 to your computer and use it in GitHub Desktop.

Select an option

Save locriani/a11204e6d934f340da06 to your computer and use it in GitHub Desktop.
SSH Terminal Color Hack
alias ssh="~/.bash/ssh.sh"
www.example.com
list your safe servers on each newline
This file lives in your home directory (not in ~/.bash)
You need at least one "safe" server in order for the script to function properly
function onExit {
osascript ~/.bash/terminal_color.scpt "Pro"
}
trap onExit EXIT
safe_server=`echo "$@" | grep -i --max-count=1 -f ~/.safe_servers | wc -l`
if [ $safe_server -gt 0 ]; then
osascript ~/.bash/terminal_color.scpt "SafeRemote"
else
osascript ~/.bash/terminal_color.scpt "Remote"
fi
/usr/bin/ssh "$@"
on run argv
tell application "Terminal" to set current settings of selected tab of window 1 to (first settings set whose name is (item 1 of argv))
end run
-- iTerm2 User?
-- change the ssh.sh script to use colors instead of theme names and use this AppleScript instead:
--
-- on run argv
-- tell application "iTerm" to set background color of current session of current terminal to (item 1 of argv)
-- end run
@Emily

Emily commented Jul 3, 2014

Copy link
Copy Markdown

Such star. Much Bright.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment