Author Topic: [bash] show mac address  (Read 1071 times)

0 Members and 1 Guest are viewing this topic.

Offline frog

  • Knight
  • **
  • Posts: 232
  • Cookies: 16
    • View Profile
[bash] show mac address
« on: June 01, 2012, 03:40:06 am »
Code: (bash) [Select]
#!/bin/bash
##
### showmac.sh - display mac address
##
#
export MACADDR
export IFACE

if [ -z $1 ]
  then
    echo "Usage: $0 <interface>"
    echo " Example: $0 wlan1"
    exit
fi

IFACE=$1
MACADDR=`ifconfig $IFACE | grep "HW"`

echo ${MACADDR:38:18}
« Last Edit: June 01, 2012, 10:57:00 pm by frog »