Created
April 5, 2013 17:47
-
-
Save sergioharo/5321209 to your computer and use it in GitHub Desktop.
Bash script to programatically change the network location on a mac. This can be used for example to switch to a network location with a SOCKs proxy. The proxy can be started before the last exit.
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/bash | |
trap 'exit_with_reset; exit' SIGTERM SIGQUIT SIGINT SIGHUP | |
exit_with_reset() | |
{ | |
echo "Resetting network location" | |
scselect "Automatic" | |
} | |
echo "Changing network location" | |
scselect "Name of my alternate location | |
sleep 10 | |
echo "Do something else here if you want" | |
exit_with_reset |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment