#!/bin/bash clear # Get IP - Start ip=$(ipconfig getifaddr en0) nen=0 while [ -z $ip ]; do let nen=nen+1 eth="en$nen" #echo $eth ip=$(ipconfig getifaddr $(echo $eth)) done echo "Internal IP: " $ip # Get IP - Stop #Variables - stop #echo "External IP: " $(curl -s https://www.kittell.net/ip.php) echo "External IP: " $(curl -s http://api.ipaddress.today)
Originally Posted on June 17, 2016
Last Updated on June 7, 2019
Last Updated on June 7, 2019
All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development) system it is suggested you test it and fully understand what it is doing not just what it appears it is doing. I accept no responsibility for any damage you may do with this code.