I was puzzling over this yesterday when considering my Linux laptop using dhcp to make use of the cable modem. I'll confess that it's the first thing i thought of, but it seems to work.
use `ping known.good.ip.address`
and parse the output for your ip address.
for example
[root@sysname /root]# ping 198.133.16.99
PING 198.133.16.99 (198.133.16.99) from your.ip.numbers.here : 56(84) bytes of data.