On 20 Jun 11:29, Mark Rogers wrote:
On 20/06/12 09:49, Brett Parker wrote:
Surely, you mean... mac=$(</sys/class/net/eth0/address)
Thanks Brett and Adam, that's much nicer.
Can I combine that with the removal of ":" characters in a single command?
That does rely on the sys filesystem though...
Is that ever likely to be an issue on a Debian-based install? The boxes I'm playing with are mostly ARM processors (my current tests are on a Pi) running Debian 6, although I'll need things to also work on Ubuntu Server installs too.
Unlikely on anything even remotely modern to be a problem.
Thought you needed it both with and without the colons?
mac=$(OLDIFS="$IFS";IFS=":"; for thing in $(<sys/class/net/eth0/address); do echo -n $thing; done)
Not, erm, pretty - but functional.