Mailinglist Archive: opensuse (3107 mails)
| < Previous | Next > |
Re: [opensuse] Grabbing MAC address of interface
- From: Randall R Schulz <rschulz@xxxxxxxxx>
- Date: Fri, 16 Feb 2007 14:26:58 -0800
- Message-id: <200702161426.59100.rschulz@xxxxxxxxx>
On Friday 16 February 2007 12:40, Jan Engelhardt wrote:
> Hi,
>
> ...
>
> > How could a locale change break a grep for HWaddr ?
> > ...
>
> 21:39 ichi:~ > ifconfig lo
> lo Link encap:Local Loopback
> inet addr:127.0.0.1 Mask:255.0.0.0
> ...
>
> 21:39 ichi:~ > LC_MESSAGES=de_DE ifconfig lo
> lo Protokoll:Lokale Schleife
> inet Adresse:127.0.0.1 Maske:255.0.0.0
> ...
>
> As you can see:
>
> inet addr:127.0.0.1 Mask:255.0.0.0
> inet Adresse:127.0.0.1 Maske:255.0.0.0
>
> and whoops, things like /bin/cut -b or head/tail --bytes are not
> accurate anymore.
Then perhaps you could fix the locale in the invocation you want to use
to extract the MAC address (just as you did to generate this example).
Though personally, I think using the system's introspection files
(e.g., /sys/class/net/eth?/address), while not portable outside Linux,
is a lot cleaner than scraping information from the output of commands
that is intended to be read by humans.
>
> Jan
Randall Schulz
--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx
> Hi,
>
> ...
>
> > How could a locale change break a grep for HWaddr ?
> > ...
>
> 21:39 ichi:~ > ifconfig lo
> lo Link encap:Local Loopback
> inet addr:127.0.0.1 Mask:255.0.0.0
> ...
>
> 21:39 ichi:~ > LC_MESSAGES=de_DE ifconfig lo
> lo Protokoll:Lokale Schleife
> inet Adresse:127.0.0.1 Maske:255.0.0.0
> ...
>
> As you can see:
>
> inet addr:127.0.0.1 Mask:255.0.0.0
> inet Adresse:127.0.0.1 Maske:255.0.0.0
>
> and whoops, things like /bin/cut -b or head/tail --bytes are not
> accurate anymore.
Then perhaps you could fix the locale in the invocation you want to use
to extract the MAC address (just as you did to generate this example).
Though personally, I think using the system's introspection files
(e.g., /sys/class/net/eth?/address), while not portable outside Linux,
is a lot cleaner than scraping information from the output of commands
that is intended to be read by humans.
>
> Jan
Randall Schulz
--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx
| < Previous | Next > |