eshsf wrote:
Hello,

On Fri, 16 Feb 2007 14:33:12 +0100 (MET)
Jan Engelhardt <[EMAIL PROTECTED]> wrote:

Hello,


now the question may seem simple ("how to grab the MAC address of a given interface"), but what is actually a "portable" way that does not potentially break when upgrading to a newer openSUSE?

I could fiddle with `hwinfo --network` or try parse `ip l sh dev br0` output, but what's actually best? [Using sh.]

How about this?

% cat /sys/class/net/eth?/address


eshsf

Or the long version:
/sbin/ifconfig [interface] | grep HWaddr | tail --bytes=20 | head --bytes=17

I'm sure that could be rewritten to something less ugly to ignore the last three "empty" bytes.

This will work on other dists aswell, where as /sys/class/net/eth?/address does not exists on e.g. debian iirc.

Best regards
Sylvester Lykkehus
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to