Posted on 02-11-2009 11:46 AM
If you have a .plist file that is treed-out...multiple levels, what is the syntax for modifying a value on a sub-level?
Lets say that it is structured as so:
Root
- Dictionary 1
- Dictionary 2
- Array 1
- Item 1
- Item 2
defaults write somepreffile -dict "Dictionary 1" -array "Array 1"
"Item 1" value
?
Thanks,
j
Posted on 02-11-2009 12:18 AM
I'm not sure you'll be able to even do that with defaults. The defaults man page says:
"BUGS Defaults can be structured in very complex ways, making it difficult for the user to enter them with this command."
That is a perfect candidate for PlistBuddy, another plist modifier that works from the command line. In OS X Leopard PlistBuddy is included (/usr/libexec), but in previous versions you would have to find in in a package receipt or something. There is a bit of documentation about this on the web.
In our Tiger base image, I copy PlistBuddy to /usr/bin so that I know it will always be in the path; now that we are using Leopard this is unnecessary.
Ryan Harter
UW - Stevens Point
Workstation Developer
715.346.2716
Ryan.Harter at uwsp.edu