Last active
December 29, 2015 06:19
-
-
Save koehn/7628485 to your computer and use it in GitHub Desktop.
Send the current IPv6 address to stdout.
This file contains 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 | |
CHECK_IP=`curl -6 -m 5 http://www.whatismyipv6.com/ 2> /dev/null | awk '/^[0-9a-f:]+<tr><td>/ { sub(/<.*/, "") }; { print $0 }' | egrep '^[0-9a-f:]+$'` | |
if [ $? -ne 0 ] | |
then | |
echo Unable to get current IP address with curl >&2 | |
exit 100 | |
fi | |
echo $CHECK_IP | sed -e 's!.*is \(.*\)</h1>.*!\1!' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment