/ Published in: Bash
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
# snippet: get_external_ip.sh # version: 0.02 # author: ksaver (at identi.ca) # license: Public Domain # arguments: Not required. # sets: extern_ip function # returns: Numerical External IP # usage: Use into a script: # source get_external_ip.sh # echo "My external IP is: $(extern_ip)" function extern_ip() { URL="http://whatismyip.org/" curl -s $URL || wget -qO- $URL || lynx -dump $URL }