Tell me more ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to update a plist file using bash. For some strings I can update the plist file, but for some strings I get an error. For eg

defaults write '/Users/test/Desktop/myPlist'  'My Key' "[My Value]"

throws an error

2011-08-10 18:49:36.208 defaults[17287:903] Could not parse: [My Value].
Try single-quoting it.

Looks like the characters '[' and ']' seem to be throwing it off. How to make this work with the string "[My Value]"?

share|improve this question
Maybe try single-quoting it...? – Wuffers Aug 11 '11 at 1:55

1 Answer

You could try single-quoting it, like this:

defaults write '/Users/test/Desktop/myPlist'  'My Key' "\"[My Value]\""
share|improve this answer
2011-08-10 19:05:44.531 defaults[17323:903] Could not parse: \'[My Value]\'. Try single-quoting it. Didnt work :( – smokinguns Aug 11 '11 at 2:02
This seemed to work: defaults write '/Users/test/Desktop/myPlist' 'My Key' "\"[My Value]\"" Wonder why? – smokinguns Aug 11 '11 at 2:04
Alright, will edit my answer. – Wuffers Aug 11 '11 at 2:12

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.