hw-1

Property List File operate

Property List File operate

1
2
3
4
5
6
7
8
9
10
11
12
13
14
# add remove modify
/usr/libexec/PlistBuddy -c "clear dict" -c "add :CFBundleURLTypes array" -c "add :CFBundleURLTypes:0 dict" -c "add :CFBundleURLTypes:0:CFBundleURLName string 'urlname-1'" -c "add :CFBundleURLTypes:0:CFBundleURLSchemes array" -c "add :CFBundleURLTypes:0:CFBundleURLSchemes:0 string urlscheme-1" Info.plist


plutil -remove yj ./yiji.plist
plutil -insert yj -xml "<dict/>" ./yiji.plist
plutil -remove jx ./yiji.plist
plutil -insert jx -xml "<dict/>" ./yiji.plist
plutil -insert "yj.jx${jx}_gz${gz}" -string "${yi},${ji}" ./yiji.plist

#to json
plutil -convert json input.plist -r -o output.json
plutil -convert json input.json -o output.plist