Created
July 28, 2016 05:55
-
-
Save AidenMontgomery/8554b6f32fb0368b6cf27aa876caa9ac to your computer and use it in GitHub Desktop.
Update all network interfaces to use the specified proxy settings.
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
proxy_hostname=localhost | |
proxy_port=5050 | |
nics=$(networksetup -listnetworkserviceorder | awk '/\([0-9]\)/ {print $2"_"$3}') | |
for nic in $nics; do | |
nic="${nic/_/ }" | |
nic=$(echo "${nic}" | awk '{gsub(/^ +| +$/,"")} {print $0}') | |
sudo networksetup -setwebproxy "$nic" $proxy_hostname $proxy_port | |
sudo networksetup -setsecurewebproxy "$nic" $proxy_hostname $proxy_port | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment