Skip to content

Instantly share code, notes, and snippets.

@Celeborn2BeAlive
Last active July 5, 2018 22:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Celeborn2BeAlive/08cafd1dcaa5f54e0512df95fa285dfe to your computer and use it in GitHub Desktop.
Save Celeborn2BeAlive/08cafd1dcaa5f54e0512df95fa285dfe to your computer and use it in GitHub Desktop.
Shell function to get external IP address
getip() {
echo `curl http://checkip.dyndns.org 2> /dev/null | sed -nre 's/^.* (([0-9]{1,3}\.){3}[0-9]{1,3}).*$/\1/p'`
return 0
}
IP=`getip`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment