• 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
Re: diskutil_info handler (Was: UUID)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: diskutil_info handler (Was: UUID)


  • Subject: Re: diskutil_info handler (Was: UUID)
  • From: "Mark J. Reed" <email@hidden>
  • Date: Thu, 31 Jan 2008 16:33:59 -0500

On Jan 31, 2008 4:02 PM, Skeeve <email@hidden> wrote:
Just for the fun of it...

calling

   diskutil_info("/")

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

Handy.  I would have done it with -plist, I think, rather than trying to parse the output of the non-plist form...

   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;

That can be simplified to two regex matches instead of four:

while (<>) {
    if (/^\\s*(\\w[^:]+?)\\s*:\\s*(.*?)\\s*$/)
    {
          $info{$last_key=$1} = $2;
          next;
    }
    elseif ($last_key && /\S/)
    {
           chomp( $info{$last_key} .= qq(\\n) . $_ );
     }
}

--
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

  • Follow-Ups:
    • Re: diskutil_info handler (Was: UUID)
      • From: Skeeve <email@hidden>
References: 
 >UUID (From: Luther Fuller <email@hidden>)
 >diskutil_info handler (Was: UUID) (From: Skeeve <email@hidden>)

  • Prev by Date: Re: UUID
  • Next by Date: Re: UUID
  • Previous by thread: diskutil_info handler (Was: UUID)
  • Next by thread: Re: diskutil_info handler (Was: UUID)
  • Index(es):
    • Date
    • Thread