Skip to content

Instantly share code, notes, and snippets.

@auzwang
Created April 21, 2015 04:14
Show Gist options
  • Save auzwang/827090cae932a630966f to your computer and use it in GitHub Desktop.
Save auzwang/827090cae932a630966f to your computer and use it in GitHub Desktop.
bash extras
function woff() {
# get current wifi device
CURRENT_DEVICE=$(networksetup -listallhardwareports | awk '$3=="Wi-Fi" {getline; print $2}')
echo "Current Wi-Fi Device = '$CURRENT_DEVICE'"
# turn off wifi
networksetup -setairportpower $CURRENT_DEVICE off
}
function won() {
# get current wifi device
CURRENT_DEVICE=$(networksetup -listallhardwareports | awk '$3=="Wi-Fi" {getline; print $2}')
echo "Current Wi-Fi Device = '$CURRENT_DEVICE'"
# turn on wifi
networksetup -setairportpower $CURRENT_DEVICE on
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment