Posted on 07-31-2012 09:33 AM
Is there a way via command line networksetup -setproxybypassdomains to add to the existing bypass domains without replacing what already exists on the list?
Posted on 10-03-2013 06:38 AM
I used the following script recently to check for existing settings and then add a new one.
#!/bin/bash
# Get current VPN proxy bypass settings for interface called VPN
CURRENT=networksetup -getproxybypassdomains VPN
# if result contains the word bypass then it was empty because it has included an error message therefore set variable to empty
if [[ $CURRENT = *bypass* ]]
then
CURRENT=""
fi
# If new entry not in list then
if [[ $CURRENT != *10.0.0.21* ]]
then
# add new bypass entry
CURRENT="$CURRENT 10.0.0.21"
# write new list to setting
networksetup -setproxybypassdomains VPN $CURRENT
fi
# read list again to verify
CURRENT=networksetup -getproxybypassdomains VPN
echo $CURRENT
exit