Created
August 21, 2013 18:01
-
-
Save marshall007/6297796 to your computer and use it in GitHub Desktop.
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 | |
| # Usage: | |
| # airport off | |
| # airport on | |
| # airport reset | |
| # get current wifi device | |
| CURRENT_DEVICE=$(networksetup -listallhardwareports | awk '$3=="Wi-Fi" {getline; print $2}') | |
| echo "Current Wi-Fi Device: '$CURRENT_DEVICE'" | |
| # turn wifi on/off | |
| function power { | |
| networksetup -setairportpower $CURRENT_DEVICE $1 | |
| } | |
| if [ $1 == "reset" ] | |
| then | |
| power "off" | |
| sleep 2 | |
| power "on" | |
| else | |
| power $1 | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment