How to Grab MAC Address of Active Ethernet Connection in Bash Script?
Answer #1 75 %Found the answer:
set - `ifconfig | grep -B 1 inet | head -1`
MAC=$5
I grep'd the inet
string and returned the line before. Then use head to grab the first line.
Tags: bash