Created
September 18, 2012 13:17
-
-
Save dlutcat/3743043 to your computer and use it in GitHub Desktop.
Auto switch network config between home and office.
This file contains hidden or 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 | |
# happyhouse is my home wifi name | |
happyhouse=`airport -s | grep happyhouse | wc -l` | |
if [ "${happyhouse//[[:space:]]}" = '1' ]; then | |
networksetup -setmanual wi-fi 192.168.2.129 255.255.255.0 192.168.2.1 | |
networksetup -setdnsservers wi-fi 192.168.2.1 | |
fi | |
if [ "${happyhouse//[[:space:]]}" = '0' ]; then | |
networksetup -setmanual wi-fi 192.168.0.129 255.255.255.0 192.168.0.1 | |
networksetup -setdnsservers wi-fi 192.168.0.1 | |
fi | |
#networksetup -getinfo wi-fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment