myip 503 B

12345678910111213141516
  1. #! /bin/bash
  2. # script to determine my public IP address
  3. # deal with timeouts?
  4. #myIP=`dig +short @resolver1.opendns.com myip.opendns.com`
  5. #myIP=`curl -s ifconfig.me`
  6. #echo "$myIP"
  7. #curl -s checkip.dyndns.org | sed -e 's/.*Current IP Address: //' -e 's/<.*$//'
  8. # This works very well, and quickly !!!
  9. # http://serverfault.com/questions/89114/finding-the-public-ip-address-in-a-shell-script
  10. dig @resolver1.opendns.com myip.opendns.com +short
  11. host `dig @resolver1.opendns.com myip.opendns.com +short`