-
-
Save chrishein/5785835 to your computer and use it in GitHub Desktop.
Change Terminal.app Profile when connecting through ssh according to server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Place this script in your path before /usr/local/bin . Make it executable | |
# If using .ssh/config to define username. "ssh server1" | |
HOSTNAME=$@ | |
# If connecting using "ssh user1@server1" | |
# HOSTNAME=`echo $@ | sed s/.*@//` | |
function setTerm() { PROFILE=${1}; echo "tell app \"Terminal\" to set current settings of first window to settings set \"${PROFILE}\""|osascript; }; | |
on_exit () { | |
setTerm "Basic" | |
} | |
# Uncomment to go back to default (Basic) after disconnecting | |
# trap on_exit EXIT | |
case $HOSTNAME in | |
server1|server2) setTerm "Grass" ;; | |
server3) setTerm "Homebrew" ;; | |
server4) setTerm "Man Page" ;; | |
server5) setTerm "Novel" ;; | |
*) ;; | |
esac | |
/usr/bin/ssh "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment