Heyas
Wasnt sure where to post, but thought this is most matching.
Thanks to Neo we can now see our IP and much more on: What is My IP Address?
I've always wanted a script to get my IP's, and thanks to Neo's effort, i now could do.
Outputs as follows:
$ myip.sh
Internal 192.168.10.15
External 215.163.234.18
#!/usr/bin/env bash
# File: myip.sh
# Description: Simply prints internal and external IP using http://www.unix.com/what-is-my-ip.php
# ------------------------------------------------------
#
# Variables
#
URL=http://www.unix.com/what-is-my-ip.php
DATA=$(curl -s $URL) > /dev/zero
str="DNS Lookup For"
#
# Action & Display
#
printf "%s\t%s\n" "Internal" "$(ifconfig | grep -i broadcast | grep ^[[:space:]] | awk '{ print $2}')"
printf "%s\t%s\n" "External" "$(echo "$DATA" | sed s,"$str","\n\n$str",g | sed s,"<"," ",g|grep "$str" | awk '{print $4}')"
Hope you like
Happy easter!