HowFlow


HowFlow — Sometimes you want to write a script that needs the external IP of the router your client is connected to. Here are three possible solutions.

Share it!   Posted by aroedl aroedl 2 months ago

Solution 1: wget and whatsmyip.com


#!/bin/sh
IP=`wget -q -O - http://whatismyip.com/automation/n09230945.asp`
echo $IP

Solution 2: wget and freeshell.org


#!/bin/sh
IP=$( wget -qO - http://cfaj.freeshell.org/ipaddr.cgi )
echo $IP

Solution 3: lynx and freeshell.org


#!/bin/sh
IP=$( lynx -dump http://cfaj.freeshell.org/ipaddr.cgi )
echo $IP



Please log in or sign up and vote for this trick if it was helpful for you.
Don't forget to subscribe to our RSS Feed RSS/Atom feed to get the latest tricks.