Advertisement
chotoipho

ethtool_query2.sh

Jan 8th, 2013
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.42 KB | None | 0 0
  1. # !/bin/sh
  2.  
  3. # Check if script is ran as root user
  4. if [ $(whoami) != "root" ]; then
  5.   echo "You need to run this script as root user or do 'sudo $0'."
  6.   exit 1
  7. fi
  8.  
  9. # Prints MAC Address and status of each ethernet interface.
  10. for INTERFACE in $(ifconfig -a | grep eth | awk '{print $1}'); do
  11.   echo "$INTERFACE $(ifconfig $INTERFACE | grep -i hwaddr* | awk '{print $5}') $(ethtool $INTERFACE | grep -i "link detected")"
  12. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement