Skip to content

Instantly share code, notes, and snippets.

@Cylix
Created March 12, 2016 06:20
Show Gist options
  • Save Cylix/b6c2661e6a312044331a to your computer and use it in GitHub Desktop.
Save Cylix/b6c2661e6a312044331a to your computer and use it in GitHub Desktop.
Turn off-on mac wifi if network is not available. Useful when you have a shitty box...
#!/bin/bash
if /sbin/ping -c 5 -W 1 8.8.8.8
then
: # colon is a null and is required
else
/usr/sbin/networksetup -setairportpower en0 off && /usr/sbin/networksetup -setairportpower en0 on
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment