Today I’m launching my own “What’s My IP” service. By accessing the address http://whatsmyip.reliable-ict.de you will get a text-only response containing only your (external) IP. This can be very useful to check if your internet connection works at all, to check IPv4/IPv6 connectivity, or to update your dynamic DNS entry.
On Linux, you can get the IP in the Shell with curl (for example):
curl -s http://whatsmyip.reliable-ict.de
You could then parse the address into a shell variable and use it in your shell script:
IP=$(curl -s http://whatsmyip.reliable-ict.de) echo $IP