Re: Computer Serial Number
Re: Computer Serial Number
- Subject: Re: Computer Serial Number
- From: "Mark J. Reed" <email@hidden>
- Date: Thu, 24 Jul 2008 20:26:22 -0400
Ed> Um, yes. Just for jollies, I tried it and got nine serial numbers. Still,
Ed> the basic idea is a good one.
Heh. Seven on my system.
Philip> do shell script "system_profiler SPHardwareDataType | grep
'Serial Number' |
Philip> tr -d ' ' | cut -d : -f 2"
Whenever I see grep | cut (with or without tr) I think "awk":
do shell script "system_profiler SPHardwareDataType | awk '/Serial
Number:/ {print $NF}' "
You could also take advantage of the fact that the SPHardwareDataType
stuff comes first, and just do this:
do shell script "system_profiler | awk '/Serial Number:/ {print $NF; exit}' "
which was the solution I had come up with before reading Philip's
reply. Admittedly that was based on a brute-force approach (i.e.
looking at the output) as opposed to a more nuanced method (i.e.
reading the man page for system_profiler.) :)
--
Mark J. Reed <email@hidden>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden