I use:
----------------------------------------------------------------
#!/bin/bash
# Name: myip
# Author: O-P
# Purpose: Check current public IP address
curl -s checkip.dyndns.org|sed -e 's/.*Current IP Address: //' -e 's/<.*$//'
-----------------------------------------------------------------
This is in ~/bin so it's in my $PATH. I type myip at a prompt, press the Enter key, and the number is displayed.