Re: Script Test [OT]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 2008-09-06 at 11:54 -0600, 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?

/sbin/ifconfig eth0|awk 'NR==1 {print $5}'

(adjust for your primary interface name). Note that this isn't
identifying the machine, it's identifying a network interface, but that
may be good enough for your purpose.

> 2.How do I make this comparison in bash? I guess this value must be a string?

if [ $(/sbin/ifconfig eth0|awk 'NR==1 {print $5}') = 00:16:76:C2:87:D2 ]
then
	echo yes
else
	echo no
fi

poc

-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux