Here's a quick script to get your WAN IP. I didn't write this, but I found this somewhere on the interwebs. If you published this to the 'net originally, let me know and I'll provide due credit.
curl -s myip.dk | grep '"Box"' | egrep -o '[0-9.]+'