• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
diskutil_info handler (Was: UUID)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

diskutil_info handler (Was: UUID)


  • Subject: diskutil_info handler (Was: UUID)
  • From: Skeeve <email@hidden>
  • Date: Thu, 31 Jan 2008 22:02:00 +0100

Just for the fun of it...

calling

   diskutil_info("/")

will give you a record of all the information diskutil -info returns.

So calling

   get |UUID| of diskutil_info("/")

will give you the UUID of the root disk.


Here is the handler...

on diskutil_info(a_disk)
return run script (do shell script "diskutil info " & (quoted form of POSIX path of a_disk) & " | perl -e " & quoted form of "
use strict;
use warnings;
my (%info, $last_key);
while (<>) {
chomp;
next if /^$/;
s/^\\s+//;
s/\\s+$//;
if (s/^(\\w[^:]+?)\\s*:\\s*//) {
$last_key= $1;
$info{ $last_key }= $_;
next;
}
$info{ $last_key }.= qq(\\n).$_ if $last_key;
}
print '{',join(',',map { qq(|$_|:).quote($info{$_}) } keys %info),'}';
sub quote {
my($txt)= @_;
$txt=~ s/\"/\\\\\"/g;
return qq(\"$txt\");
}")
end diskutil_info
_______________________________________________
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
  • Follow-Ups:
    • Re: diskutil_info handler (Was: UUID)
      • From: "Mark J. Reed" <email@hidden>
References: 
 >UUID (From: Luther Fuller <email@hidden>)

  • Prev by Date: Re: GUIscritpting, Pages and PDF
  • Next by Date: Re: UUID
  • Previous by thread: Re: UUID
  • Next by thread: Re: diskutil_info handler (Was: UUID)
  • Index(es):
    • Date
    • Thread