Plist weirdness

AncillaryCheese
New Contributor

Hi all,

 

I'm jumping into editting plist files with scripts and I'm seeing something I don't know how to handle and I'm hoping someone has seen this kind of thing before and can point me in the right direction. 

 

What I am tryingto do is to read a plist, edit a value, then put the result back in. I'm using 'defaults read | grep' to pull the value I want, but what is returned looks like:

SyncTargets = {length = 118, bytes = 0x1a2b3c4d 11aa22bbcc ... 12345678}

Is there a way to read this value into a string? I'm expecting the string to be base64 encoded when it reads the plist because this is how it appears in the plist file when I inspect it manually. I have never seen this before and I can't find the magic phrase to put into Google to find what I'm looking at and what I can do with it.

 

I have the decoding, modifying, encoding and writing back into the plist all working, it's just this weird read result that I don't know what to do with.

 

Help me Jamf Community, you're my only hope!

 

 

1 REPLY 1

sdagley
Esteemed Contributor II

@AncillaryCheese You might want to check out PlistBuddy (your preferred search engine will turn up many more results) as a tool to manipulate .plist files.

The man page for the defaults command contains the note "WARNING: The defaults command will be changed in an upcoming major release to only operate on preferences domains. General plist manipulation utilities will be folded into a different command-line program." Only Apple knows when that's going to happen, but if you're building something that needs to manipulate a .plist it's probably better to do it in a way that won't require rewriting in the near future.