On a Mac (and probably FreeBSD & Linux too) this will give you your current external IP address.

curl -s checkip.dyndns.org | sed -e 's/.*Current IP Address: //' -e 's/<.*$//'