How To Find My Public IP Address
Use dig command for determining my public IP address:
dig +short myip.opendns.com @resolver1.opendns.com
Store my IP address in a shell variable with the following syntax:
myip="$(dig +short myip.opendns.com @resolver1.opendns.com)" echo "My WAN/Public IP address: ${myip}"