Skip to content

Instantly share code, notes, and snippets.

@BaksiLi
Last active August 11, 2023 13:33
Show Gist options
  • Save BaksiLi/9a8fd4707c9a14ccc24cde735afdfecf to your computer and use it in GitHub Desktop.
Save BaksiLi/9a8fd4707c9a14ccc24cde735afdfecf to your computer and use it in GitHub Desktop.
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