Merge pull request #21 from baddylan/main

Updated whatsmyip command.
This commit is contained in:
Chris Titus
2023-07-17 11:06:49 -05:00
committed by GitHub

20
.bashrc
View File

@@ -485,12 +485,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