From a6feb680779f2b04323a6d8046b6e83d73bf6eb1 Mon Sep 17 00:00:00 2001 From: Dylan Copeland Date: Sun, 21 May 2023 16:13:49 -0500 Subject: [PATCH] Updated whatsmyip command. --- .bashrc | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/.bashrc b/.bashrc index 2372206..6547783 100644 --- a/.bashrc +++ b/.bashrc @@ -484,12 +484,24 @@ function whatsmyip () { # Dumps a list of all IP addresses for every device # /sbin/ifconfig |grep -B1 "inet addr" |awk '{ if ( $1 == "inet" ) { print $2 } else if ( $2 == "Link" ) { printf "%s:" ,$1 } }' |awk -F: '{ print $1 ": " $3 }'; - + + ### Old commands # Internal IP Lookup - echo -n "Internal IP: " ; /sbin/ifconfig eth0 | grep "inet addr" | awk -F: '{print $2}' | awk '{print $1}' + #echo -n "Internal IP: " ; /sbin/ifconfig eth0 | grep "inet addr" | awk -F: '{print $2}' | awk '{print $1}' +# +# # External IP Lookup + #echo -n "External IP: " ; wget http://smart-ip.net/myip -O - -q + + # Internal IP Lookup. + if [ -e /sbin/ip ]; + then + echo -n "Internal IP: " ; /sbin/ip addr show wlan0 | grep "inet " | awk -F: '{print $1}' | awk '{print $2}' + else + echo -n "Internal IP: " ; /sbin/ifconfig wlan0 | grep "inet " | awk -F: '{print $1} |' | awk '{print $2}' + fi - # External IP Lookup - echo -n "External IP: " ; wget http://smart-ip.net/myip -O - -q + # External IP Lookup + echo -n "External IP: " ; curl -s ifconfig.me } # View Apache logs