Posted on 09-08-2011 07:58 AM
Hi guys,
Just updated my Extension Attribute that reports back if the mac has an Extension Attribute card installed.
code below, & updated my blog: http://wp.me/p12A66-32
#!/bin/sh
checkHasAnAirportCard=networksetup -listallhardwareports | grep "Hardware Port: Air" | cut -c 16-
checkHasWiFi=networksetup -listallhardwareports | grep "Hardware Port: Wi-" | cut -c 16-
if [[ -z "$checkHasAnAirportCard" && -z "$checkHasWiFi" ]]; then
echo "<result>No</result>"
else
echo "<result>Yes</result>"
fi
Posted on 09-08-2011 08:23 AM
Apologies for the weird subject.. should have read: Extension Attribute: Has Airport/Wi-Fi?
Anyway, Walter pointed out a much more elegant solution using egrep:
#!/bin/sh
checkWireless=$(networksetup -listallhardwareports | egrep "Hardware Port: (Air|Wi)" | cut -c 16-)
if [ -n "${checkWireless}" ]; then
echo "<result>Yes</result>"
else
echo "<result>No</result>"
fi