Last active
August 18, 2018 12:15
-
-
Save arastu/4997147bf14d64c8dddc72fcab3e06c6 to your computer and use it in GitHub Desktop.
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 | |
# Googooli bash function for resolve a hostname to the first IP address or find your public ip address | |
# Example: | |
# $ ipof www.google.com | |
# 216.58.204.132 | |
# find your public ip address when nothing is sent | |
# $ ipof | |
# x.x.x.x | |
function ipof() { | |
if [ -z "$1" ] | |
then | |
curl ipinfo.io/ip | |
else | |
dig +short $1 | awk '{ print ; exit }' | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Update: