Follow us on...
Follow us on Twitter Follow us on Facebook
Register
Page 1 of 2 12 LastLast
Results 1 to 8 of 12
  1. #1
    avramd is offline Registered User
    Join Date
    Dec 2000
    Location
    Mystic, CT
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    read plist files from command line?

    Can anyone tell me if there is a command line tool to read values out of plist files?

    I'm trying to write a script to automate installing the Balthisar Ghostscript Network Printer package, and I want it to check the version of the LPR module before replacing it. I wanted to do something cleaner than just parsing it's Info.plist file in perl.

  2. #2
    lethe is offline Registered User
    Join Date
    Oct 2001
    Location
    US
    Posts
    689
    Thanks
    0
    Thanked 0 Times in 0 Posts
    the 'defaults' command is what you are looking for. check out the man pages. here are some highlights

    defaults domains will tell you all the domains of preferences available.

    default read domainname reads some domain s preferences

    example: defaults read com.omnigroup.OmniWeb will output the preferences of OmniWeb.

    defaults read com.omnigroup.OmniWeb StartPage will tell you what omniweb is using for a start page.

    you can write preferences this way too

  3. #3
    avramd is offline Registered User
    Join Date
    Dec 2000
    Location
    Mystic, CT
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    defaults can't read all plist files

    I actually had already tried defaults. The trouble is, the plist file I want to read is not actually a preferences file. It's

    /System/Library/Printers/IOMs/LPRIOM.plugin/Contents/version.plist

    From what I can tell, there is no way to get defaults to parse a specific file.

  4. #4
    ksv's Avatar
    ksv
    ksv is offline web developer
    Join Date
    Nov 2000
    Location
    Trondheim, Norway
    Posts
    3,009
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Try "sudo pico /System/Library/Printers/IOMs/LPRIOM.plugin/Contents/version.plist"
    Pico is a great text editor for editiong .plist files
    leo at code.coop

    Co-operatives are private corporations based on the values of self-help, self-responsibility, democracy, equality, equity and solidarity.

  5. #5
    genghiscohen's Avatar
    genghiscohen is offline Membrum virile
    Join Date
    Sep 2001
    Location
    Sea of Tranquility
    Posts
    805
    Thanks
    0
    Thanked 0 Times in 0 Posts
    If you have the Developer Tools installed, PropertyList Editor will give you a very clean and easy-to-read listing of values for any .plist file.
    --
    "No left turn unstoned."
    (PowerBook 15" 1.5 GHz/80/1.5 GB, eMac 1 GHz/80/768 MB, SuperDrive, 250 GB FireWire HD, Lexmark Z65 printer, Epson Perfection 1200U scanner)

  6. #6
    lethe is offline Registered User
    Join Date
    Oct 2001
    Location
    US
    Posts
    689
    Thanks
    0
    Thanked 0 Times in 0 Posts
    those are both nice tools, but if you look carefully, you will see that this guy needs this for a script, so pico and property list editor are not viable options. defaults is a good bet, but avramd, you re right, i can t see how to make defaults read a specific file. seems stupid for it not to be able, but ...

    sorry. guess you ll have to parse it yourself. i ll let you know if i think of anything

  7. #7
    avramd is offline Registered User
    Join Date
    Dec 2000
    Location
    Mystic, CT
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Wow, cool

    That's great, I'll give it a try. It'll be a few days before I can get back to this project, but I'll let you know how it works out.

    Thanks for going through the trouble - this is a lot more of a response than I expected to get from a bulletin board!

  8. #8
    rharder's Avatar
    rharder is offline Do not read this sign.
    Join Date
    Mar 2001
    Location
    Virginia, USA
    Posts
    1,189
    Thanks
    0
    Thanked 3 Times in 3 Posts
    Anyone ever determine if there is a plist command line editor? Or a secret flag to make defaults read an arbitrary file?

    -Rob

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. How do you read .ps files?
    By buc99 in forum Unix & X11
    Replies: 14
    Last Post: February 4th, 2007, 11:10 AM
  2. convert *.chm files to read under osx
    By leleka in forum Mac OS X System & Mac Software
    Replies: 6
    Last Post: January 8th, 2004, 02:58 AM
  3. small (?) problem with plist
    By saffron in forum Mac OS X System & Mac Software
    Replies: 5
    Last Post: June 29th, 2003, 08:32 AM
  4. classic lets you read other ppl's files
    By bighairydog in forum Apple News, Rumors & Discussion
    Replies: 2
    Last Post: December 10th, 2001, 09:54 PM
  5. PLEASE READ THE HELP FILES
    By palndron in forum Mac OS X System & Mac Software
    Replies: 2
    Last Post: September 25th, 2000, 11:17 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •