Script Test [OT]
Les Mikesell
lesmikesell at gmail.com
Sat Sep 6 19:16:39 UTC 2008
kwhiskerz wrote:
> The problem is that both computers return hostname = localhost, so that won't
> work. IP address is not always possible, as the network might not be up,
> especially on the laptop.
>
> How would I check the HWaddress (MAC)?
>
> As ifconfig returns a whole list of things:
>
> 1.How can I isolate just 00:xx:xx:xx:xx:xx in order to make a comparision?
Just grep for it, you only need to verify that it is there, not isolate it.
> 2.How do I make this comparison in bash? I guess this value must be a string?
Use grep's return status instead of doing things the shell doesn't does
as well.
if ! ifconfig eth0 | grep -q 00:xx:xx:xx:xx:xx
then
echo 'wrong box'
exit 1
fi
..rest of script..
You could also find this value in /etc/sysconfig/network-scripts/ifcfg-eth0
--
Les Mikesell
lesmikesell at gmail.com
More information about the fedora-list
mailing list