• 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: Regular expressions help request: source file of disk image volume
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Regular expressions help request: source file of disk image volume


  • Subject: Re: Regular expressions help request: source file of disk image volume
  • From: Ian Ward Comfort <email@hidden>
  • Date: Mon, 14 Aug 2006 15:10:59 -0700

On Aug 14, 2006, at 2:46 PM, Laine Lee wrote:
Anyway, my solution is to use a shell script that gets a list of all disk image volume paths, then gets a list of disk image files whose volumes are mounted. Both of the lists are generated through "hdiutil info" shell script commands. The I just use a hash table to pair up the results and find the item I want. Included are the broken regular expressions used for the shell script followed by some that seem to be working now. What I'm hoping to get help with is a better regular expression string - one that isn't likely to break again. Thanks.

-- Broken list disk image volumes: paragraphs of (do shell script "hdiutil info" & space & "|grep ^/ dev/disk |grep -o /Volumes/.*' '*")

I'm not sure how you settled on the *' '* pattern here, but I'd use something like


hdiutil info | grep ^/dev/disk | grep -o '/Volumes/.*'

Note that the single quotes are necessary to prevent the shell from expanding /Volumes/.* as a glob. Also note that this will miss any disk images mounted outside of /Volumes (e.g. those attached with - mountroot or -mountpoint). To get those I might use something like

hdiutil info | sed -ne 's/.*Apple_HFS[[:space:]]*//p'

which should catch all HFS partitions mounted from disk images.

—IWC

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Regular expressions help request: source file of disk image volume (From: "Laine Lee" <email@hidden>)

  • Prev by Date: Regular expressions help request: source file of disk image volume
  • Next by Date: Re: Regular expressions help request: source file of disk image volume
  • Previous by thread: Regular expressions help request: source file of disk image volume
  • Next by thread: Re: Regular expressions help request: source file of disk image volume
  • Index(es):
    • Date
    • Thread