A releváns rész:
ipurl=('http://whatismyipaddress.com/' 'http://www.ip-adress.com/' 'http://www.whatsmyip.org/' 'http://www.whatismyip.org/' 'http://www.cmyip.com/' 'http://my-i-p.com/')
user_agent='Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20100101 Firefox/8.0'
iface='p10p1'
releasefile='/etc/system-release'
name="${0##*/}"
wanaddr() {
IPADDR=''
cnt=2
while [ -z "$IPADDR" -a $cnt -gt 0 ]; do
for ((j=0; j<3; j++)); do
for i in 0 3; do
IP_ADDR[j]=''
url="${ipurl[j+i]}"
[ ! -z "$url" ] && IP_ADDR[j]="`wget -l1 -U "$user_agent" -O - "$url" 2>/dev/null | grep -Eo '([[:digit:]]{1,3}\.){3}[[:digit:]]{1,3}' | head -n1`"
[ ! -z "${IP_ADDR[j]}" ] && break
done
done
if [ x"${IP_ADDR[0]}" = x"${IP_ADDR[1]}" -o x"${IP_ADDR[0]}" = x"${IP_ADDR[2]}" ]; then
IPADDR="${IP_ADDR[0]}"
elif [ x"${IP_ADDR[1]}" = x"${IP_ADDR[2]}" ]; then
IPADDR="${IP_ADDR[1]}"
fi
((cnt--))
done
}
tr [:lower:] [:upper:] <<<locsemege
LOCSEMEGE