This bash script helps to identify the external IP address using ipecho.net service. There are several ways to finding an external IP of a system but this is one where you can quickly get it in your script and use it for in your programming!!
--------------------------------------------------------------------------------------------------------------
#!/bin/bash
# This script gets you the external IP address of your system.
EXT_IP=$(curl ipecho.net/plain 2>/dev/null)
LOCAL_IP=$(hostname -I 2>/dev/null)
HOSTNAME=$(hostname -f 2>/dev/null)
printf "\n***********************************************\n"
printf "Your External IP address is:"$EXT_IP"\n"
printf "Your Machine's Host name is:"$HOSTNAME"\n"
printf "Your Local IP is:"$LOCAL_IP"\n"
printf "\n***********************************************\n"
printf "Have a great day!\n\n"
----------------------------------------------------------------------------------------------------------------
No comments:
Post a Comment