使用shell脚本编辑plist文件 [英] Editing plist file using shell script

查看:96
本文介绍了使用shell脚本编辑plist文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用 pkgbuild 创建了一个默认的组件属性列表文件.该文件看起来像:

I have used pkgbuild to create a default Component Property List file. The file looks like:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-     1.0.dtd">
<plist version="1.0">
<array>
    <dict>
        <key>BundleHasStrictIdentifier</key>
        <true/>
        <key>BundleIsRelocatable</key>
        <true/>
        <key>BundleIsVersionChecked</key>
        <true/>
        <key>BundleOverwriteAction</key>
        <string>upgrade</string>
        <key>RootRelativeBundlePath</key>
        <string>MyApp.app</string>
    </dict>
</array>
</plist>

我想使用 shell 脚本修改这个文件.我尝试使用 defaults write 但它没有做任何事情.

I want to modify this file by using shell script. I tried using defaults write but it didn't do anything.

有什么方法可以做到?(例如:我想设置BundleIsRelocatable为false)

What is the way to do it?(For example: I want to set BundleIsRelocatable to false)

推荐答案

还有:

plutil -replace BundleIsRelocatable -bool false plistfilename.plist

这篇关于使用shell脚本编辑plist文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆