Using defaults read to get value from plist


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Using defaults read to get value from plist
# 1  
Old 10-23-2008
Question Using defaults read to get value from plist

Hi there,

I'm trying to retrieve a value from a plist file, which I have done before with no problems, however this plist file looks a little different....

Normally it's like this;
<plist version="1.0">
<dict>
key>KeyName</key>
<string>blah</string>

I want the value of KeyName, so 'defaults read com.example KeyName' returns the value "blah".

But the plist I'm having problems with is like this....
<plist version="1.0">
<dict>
key>HEADING</key>
<dict>
<key>KeyName</key>
<string>blah</string>

...and 'defaults read com.example KeyName' returns an error saying the domain/default pair does not exist.

Please can anyone advise if there is a way to retrieve this value?

Kind Regards
davewg
# 2  
Old 10-23-2008
SOLVED - Hi I've created a routine in perl that will read this key Smilie
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Editing .plists with defaults

I've done simple edits with defaults, but they usually are the parent parameter. For example changing the value of "DateCellWidthCache" =. What if I want to change a parameter in one of the sub categories such as "MMM d, y' '",? How do I type that out at the end of my defaults write command?: ... (1 Reply)
Discussion started by: sudo
1 Replies

2. Shell Programming and Scripting

Defaults read/write question

OSX 10.9 How does "defaults" know where to look for .plists? To expand: defaults read com.apple.finder is located in ~/Library/Preferences but, defaults read com.apple.mail is located in ~/Library/Containers/com.apple.mail/Data/Library/Preferences/com.apple.mail.plist So my question... (0 Replies)
Discussion started by: sudo
0 Replies

3. Shell Programming and Scripting

Parse hdiutil -plist data for specific info

I am trying to get the mounted size of a compressed .dmg. I can use hdiutil imageinfo -plist $imagename to get a lot of info, including what I need. The problem is that I have no idea how to parse that single piece of info into a variable (or in this case, array element). Here is what I have so... (2 Replies)
Discussion started by: nextyoyoma
2 Replies

4. Shell Programming and Scripting

Parsing plist file ?

Hi, I wondered if it was possible to parse a plist file like this http://dl.dropbox.com/u/14586156/stuff/Bookmarks.plist so it will afterwards look like this <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"... (0 Replies)
Discussion started by: pasc
0 Replies

5. OS X (Apple)

Plist to Unix Executable

I'm using an old conversion method for converting a plist into an XML file, but that's not what I'm needing just via terminal now. What I'm looking for is an answer to convert a plist file into an executable. I'd like to import it into Casper and have the JSS push it out onto an image. In this... (6 Replies)
Discussion started by: unimachead
6 Replies

6. UNIX for Advanced & Expert Users

assigning variables to their defaults

Hi, Is there any way to assign defaults values to the shell variables without reassigning them ( restarting the session) for example after login the value of ORACLE_HOME=/a/b/c i have changed this value from the console export ORACLE_HOME=/c/d now what if i want the value exported to... (1 Reply)
Discussion started by: clx
1 Replies

7. UNIX for Dummies Questions & Answers

max os x .plist not running as scheduled?

Hello all, I am admittedly a newbie and have created a plist designed to fire off a shell script everyday at 3:00pm. It is located in /Library/LaunchDaemons/. I use it to mirror a hard local drive with a remote one. It worked one time but not again after that. I never restart the machine... (0 Replies)
Discussion started by: Movomito
0 Replies

8. OS X (Apple)

the best way of editing .plist files

:( what is the best way of editing the various .plist files without adding third party files? Or is the easiest way is to add third party applications, which ones? please kept in mind that i am not a programmer. mike (1 Reply)
Discussion started by: mehow
1 Replies

9. Shell Programming and Scripting

Using 'defaults read' and storing the output in a variable

Hi all, I'm creating a script which uses 'defaults read' to retrieve details from an Info.plist like this; defaults read "/Path/Contents/Info" CFBundleShortVersionString This works fine in Terminal and returns the expected values. Is it possible to use this command in a script, and... (0 Replies)
Discussion started by: davewg
0 Replies

10. IP Networking

defaults httpd.conf

I have found in the httpd.conf where it it states the default parse pages like index.htm, index.html, index.php and etc....However, my computer box does not seem to want to automatically load the index.php files. Anyone have any ideas? (5 Replies)
Discussion started by: macdonto
5 Replies
Login or Register to Ask a Question