I have very basic knowledge of bash scripts but nothing complex. I've been searching/testing for days and can't get the results I need...
I have an Info.plist located in: /Dir1/Dir2
In the Info.plist is an array: CFBundleURLTypes
In that array is a key: CFBundleURLIsPrivate
And that key is: TRUE
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLIsPrivate</key>
<true/>
</dict>
I want to change this value to FALSE but my testing hasn't worked. Here's what I've tried and if there's a better way to do this, PLEASE let me know! TIA
#!/bin/bash
#Access working directory
cd /Dir1/Dir2
sed -i "/<key>CFBundleURLIsPrivate</{n;s/true/false/;}" Info.plist
The sed
pattern should work fine, however, on OS X (which I'll assume you're using) in-place edits have to be done slightly different:
sed -i '' "/<key>CFBundleURLIsPrivate</{n;s/true/false/;}" Info.plist
If you don't include the ''
then you'll likely get an invalid command error.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.