Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'phone.sh suggestion' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
phone.sh suggestion
Authored by: lugal on Aug 28, '08 04:18:38PM

We've used a similar sort of home-grown tracker for a few years now. I haven't had the chance yet to compare the author's solution to ours, but I can report that our method for finding the serial number is faster than either the original code, or your improved version:

serialnumber=`ioreg -c "IOPlatformExpertDevice" | awk 'BEGIN{FS="\""}; /IOPlatformSerialNumber/ {print $4}'`



[ Reply to This | # ]
phone.sh suggestion
Authored by: patpro on Aug 28, '08 09:55:37PM

Nice one!

In fact there is so much room for improvement in that script :)


---
http://www.patpro.net/



[ Reply to This | # ]
phone.sh suggestion
Authored by: engelby on Aug 29, '08 06:55:03PM

Indeed there is. This is actually a version 2 of my script. The first was much smaller than this, so this is a huge improvement over it. I know there is a lot more that could be done to it.



[ Reply to This | # ]
phone.sh suggestion
Authored by: ctierney on Aug 29, '08 06:59:46AM
That is a lot quicker! You can make it even faster by quitting awk when you find the serial number. On my mac ioreg -c 'IOPlatformExpertDevice' prints 407 lines of text, and the serial number is at the top in line 11 (profiling with time utility):
time ioreg -c 'IOPlatformExpertDevice' | awk -F\" '/IOPlatformSerialNumber/ {print $4; exit}'


[ Reply to This | # ]