Skip to content

Instantly share code, notes, and snippets.

@boywhoroared
Last active August 29, 2015 13:57
Show Gist options
  • Save boywhoroared/9434099 to your computer and use it in GitHub Desktop.
Save boywhoroared/9434099 to your computer and use it in GitHub Desktop.
Setup your OS X environment based on your "location" by checking the WiFi network you're connected to.
#!/bin/sh
# the name of your Wireless interface. Might be en1 on some machines.
AIRPORT="en0"
# name of the wifi network
WIFI_WORK="<name-of-your-office-wifi>";
if networksetup -getairportnetwork $AIRPORT | grep -i -a $WIFI_WORK ;
then
# commit using my office credentials
export GIT_AUTHOR_NAME="<Your Name>"
export GIT_AUTHOR_EMAIL="<Your Email>"
export GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"
export GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment