Posted By

jeromegamez on 07/03/10


Tagged

ethernet wifi Information


Versions (?)

Display current IP addresses (Ethernet & WiFi)


 / Published in: Bash
 

  1. #! /bin/bash
  2. myen0=`ifconfig en0 | grep "inet " | grep -v 127.0.0.1 | awk '{print $2}'`
  3.  
  4. if [ "$myen0" != "" ]
  5. then
  6. echo "Ethernet : $myen0"
  7. else
  8. echo "Ethernet : INACTIVE"
  9. fi
  10.  
  11. myen1=`ifconfig en1 | grep "inet " | grep -v 127.0.0.1 | awk '{print $2}'`
  12.  
  13. if [ "myen1" != "" ]
  14. then
  15. echo "AirPort : $myen1"
  16. else
  17. echo "Airport : INACTIVE"
  18. fi

Report this snippet  

You need to login to post a comment.