Last active
December 12, 2022 21:26
-
-
Save henri/439c108c0265262d523d9a766b02b04d to your computer and use it in GitHub Desktop.
macOS switch to specific network location
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
#!/bin/bash | |
# simple script for macOS systems. It will switch to the location specified below if it is exists. | |
switch_to_location="Automatic" | |
current_location=`scselect | grep "*" | grep -v "Defined sets include: " | awk -F "(" '{print $2}' | awk -F ")" '{print $1}'` | |
if [ "{$current_location}" != "{$switch_to_location}" ] ; then | |
scselect "${switch_to_location}" | |
exit $? | |
fi | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment