Last active
December 23, 2020 00:19
-
-
Save tempusthales/d78dc8202685b5d9463c446c92e675c4 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/sh | |
# ipv6-off.sh | |
# Disable IPv6 on all interfaces. | |
IFS=$'\n' | |
net=`networksetup -listallnetworkservices | grep -v asterisk` | |
for i in $net | |
do | |
networksetup -setv6off "$i" | |
echo "$i" IPv6 is Off | |
done | |
exit 0 |
Thanks for sharing this!
I was curious what the asterisk grep is doing so I ran the first part of the command and:
greggles@gregs-mbp ~/p/> networksetup -listallnetworkservices
An asterisk (*) denotes that a network service is disabled.
...
It seems like you could make the script more reliable and more readable by using something like:
net=`networksetup -listallnetworkservices | grep -v "denotes that a network service is disabled"`
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Updated the script, and cleaned it off a bit