Skip to content

Instantly share code, notes, and snippets.

@DennisLfromGA
Created August 25, 2015 18:29
Show Gist options
  • Save DennisLfromGA/ab40940d37be84ae3a88 to your computer and use it in GitHub Desktop.
Save DennisLfromGA/ab40940d37be84ae3a88 to your computer and use it in GitHub Desktop.
Script to grab your WAN IP address using various means.
#!/usr/bin/env sh
ipurl="icanhazip.com"
if hash dig 2>/dev/null; then cmd="dig +short myip.opendns.com @resolver1.opendns.com"; ipurl=""
elif hash curl 2>/dev/null; then cmd="curl"
elif hash wget 2>/dev/null; then cmd="wget -qO-"
else echo "*** No app (dig,curl,wget) found - exiting ***"; exit 2; fi
[ -n "$1" ] && echo -n "$cmd $ipurl - "
eval $cmd $ipurl || ret=$?
exit $ret
@saltedcoffii
Copy link

@DennisLfromGA what license is this script under?

@DennisLfromGA
Copy link
Author

@saltedcoffii,

None, I can make it private if it's an issue, just lemme know.
I have other public scripts that maybe should also be made private.

@saltedcoffii
Copy link

saltedcoffii commented Mar 20, 2021

It's not an issue at all! I just wanted to know because chromebrew packages it, and we're updating our packages with a license field. Unlicensed software is all rights reserved, so I just wanted to make sure it was that.

@DennisLfromGA
Copy link
Author

Whew!

Anyone is welcome to use my public stuff so please go ahead if you like.

I most likely grabbed this from someone else's unlicensed script but that's what's great about Linux.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment