Created
March 30, 2016 04:07
-
-
Save eaorak/59c739b2f1ffe6e3df26d38177a47bbc to your computer and use it in GitHub Desktop.
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
############################################################################## | |
# This script can be used for setting DNS on Mac computers from command line. | |
# It either sets dns to google dns servers when no parameter is provided | |
# or empties DNS settings when called with 'none'. | |
##################################################################### eaorak # | |
#!/bin/bash | |
dns='8.8.8.8 8.8.4.4' | |
empty='empty' | |
if [ "$1" = "none" ]; then | |
dns=$empty | |
fi | |
networksetup -setdnsservers Wi-Fi $dns | |
networksetup -getdnsservers Wi-Fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment