Linux shell scripts are useful for a lot of tasks. A brief tutorial on them can be found here.
Here is a very simple shell script that on executing will display the public IP address of PC.
Using any text editor (nano in this example), make the script as follows :
echo "The Public IP for this system is : "
curl -s icanhazip.com
What this script does is simply fetch the public IP address from icanhazip.com.
Accessing icanhazip in a browser will display the public IP too but for this a browser needs to be used every time.
Instead this can be directly done from Linux Terminal, so the script.
Finally, make it executable and run it :
It will display the public IP of system right from the Linux Terminal.