Last active
August 11, 2023 13:33
-
-
Save BaksiLi/9a8fd4707c9a14ccc24cde735afdfecf to your computer and use it in GitHub Desktop.
This file contains hidden or 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
function ipinfo() { | |
ip_address=${1:-$(curl -s ipinfo.io/ip)} | |
while (( "$#" )); do | |
case $1 in | |
-h|--help) | |
echo "Command: ip-info IP_ADDRESS\n" | |
echo "Default: your ip address" | |
echo "Option -s or --simple" | |
echo "==>Print only Your address" | |
return | |
;; | |
-s|--simple) | |
echo ${ip_address} | |
return | |
;; | |
*) | |
ip_address=$1 | |
shift | |
;; | |
esac | |
done | |
curl -s ipinfo.io/${ip_address} | |
echo "" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment