Last active
August 29, 2015 13:56
-
-
Save flpwgr/9234553 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
# Author: Felipe Wagner | |
# | |
# Have a Mac? | |
# Do you spend all day in terminal? | |
# Well, then u are just like me. | |
# | |
# Just add this little script into your .bash_profile, and then type: | |
# wifi (on|off) .... and done, all your airport interfaces will turn on/off | |
# | |
# v3: wifi (on|off) [interface] | |
# v2: All airport/wifi interfaces disable at the same time | |
# v1: Initial version | |
# | |
function wifi(){ | |
_interface=`networksetup -listallhardwareports | grep -E '(Wi-Fi|AirPort)' -A 1 | grep -o "en."` | |
_opt=$1 | |
if test "x${_opt}" = "x" ; then | |
echo "$FUNCNAME (on|off)" | |
return 1 | |
elif test "${_opt}" = "on" -o "${_opt}" = "off" ; then | |
for in in $_interface ; do | |
networksetup -setairportpower $in $_opt | |
done | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment