Skip to content

Instantly share code, notes, and snippets.

@rojenzaman
Created August 12, 2020 12:59
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 rojenzaman/7296287eaee1fff19f9b48395ba94140 to your computer and use it in GitHub Desktop.
Save rojenzaman/7296287eaee1fff19f9b48395ba94140 to your computer and use it in GitHub Desktop.
#!/bin/bash
curl -s ifconfig.co/json | jq -r "[.ip,.country,.city,.time_zone,.region_name,.asn,.asn_org,.hostname] | @tsv" > .tmp
while IFS=" " read -r ip country city time_zone region_name asn asn_org hostname; do
cat <<EOF
IP : $ip
Country : $country
City : $city
Time Zone : $time_zone
Region Name : $region_name
ASN : $asn
ASN Organization : $asn_org
Hostname : $hostname
EOF
done < .tmp && rm .tmp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment