Skip to content

Instantly share code, notes, and snippets.

@koehn
Created November 24, 2013 15:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save koehn/7628503 to your computer and use it in GitHub Desktop.
Save koehn/7628503 to your computer and use it in GitHub Desktop.
Send the current IP address to stdout.
#!/bin/bash
CHECK_IP=`curl -m 30 http://checkip.dyndns.org/ 2> /dev/null`
if [ $? -ne 0 ]
then
echo Unable to get current IP address with curl >&2
exit 100
fi
echo $CHECK_IP | sed -e 's!.*: \(.*\)</body>.*!\1!'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment