Created
February 3, 2015 13:51
-
-
Save wen-long/f6a5b7af7ccef86f1f2b to your computer and use it in GitHub Desktop.
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/zsh | |
if [ $UID -ne 0 ]; then | |
echo "Superuser privileges are required to run this script." | |
echo "e.g. \"sudo $0\"" | |
exit 1 | |
fi | |
OLD_IFS=$IFS | |
IFS=$'\n' | |
arr=(`networksetup -listallnetworkservices`) | |
len=${#arr[@]} | |
for ((i=2;i<$len;i++));do | |
networksetup -setdnsservers "$arr[i]" 127.0.0.1 | |
done | |
IFS=OLD_IFS | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment