wget

wget -q -O - checkip.dyndns.org|sed -e 's/.*Current IP Address: //' -e 's/<.*$//'
That will return your local IP
curl
curl -s checkip.dyndns.org|sed -e 's/.*Current IP Address: //' -e 's/<.*$//'
That one is going to give your current IP, being it public or private. Something like running ifconfig or ip
adds
curl ifconfig.me
That is going to return you the public IP you are using to access internet. If you are behind a NAT or proxy, it will the IP of that proxy.