Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

getting info from plutil

Tags:

bash

shell

ios

I'm having trouble direction info from plutil. I want to check if a .plist contains the key CFBundleShortVersionString. I don't think plutil has any option to test for if a key exists so I thought I would just plutil -show file.plist >file.txt but that just plain doesn't work. :/ So I tried to direct the plist file from stdout to file with the dump option plutil -dump file.plist >file.txt with no luck. :/ I also tried directing the stdout to stderr and stderr and stdout to file. Nothing worked. How do I do this?

like image 745
Lewis Denny Avatar asked Jan 08 '12 14:01

Lewis Denny


People also ask

What is Plutil on Mac?

DESCRIPTION. plutil can be used to check the syntax of property list files, or convert a plist file from one format to another. Specifying - as an input file reads from stdin. The first argument indicates the operation to perform, one of: -help.

What is Plutil?

plutil is a program that can convert . plist files between a binary version and an XML version. Currently, there are two versions of this utility.


1 Answers

Oneliner which doesn't depend on extra utility to install:

plutil -extract CFBundleShortVersionString xml1 -o - ./Info.plist | sed -n "s/.*<string>\(.*\)<\/string>.*/\1/p"

like image 112
Zsolt Szatmari Avatar answered Oct 18 '22 10:10

Zsolt Szatmari