Posted By

ksaver on 08/22/10


Tagged

curl Bash ip wget lynx external-ip


Versions (?)

get_external_ip.sh


 / Published in: Bash
 

URL: http://identi.ca/ksaver

  1. # snippet: get_external_ip.sh
  2. # version: 0.02
  3. # author: ksaver (at identi.ca)
  4. # license: Public Domain
  5. # arguments: Not required.
  6. # sets: extern_ip function
  7. # returns: Numerical External IP
  8. # usage: Use into a script:
  9. # source get_external_ip.sh
  10. # echo "My external IP is: $(extern_ip)"
  11.  
  12. function extern_ip()
  13. {
  14. URL="http://whatismyip.org/"
  15. curl -s $URL || wget -qO- $URL || lynx -dump $URL
  16. }

Report this snippet  

You need to login to post a comment.