我想修改plist文件中的子键(即“TB Item Identifiers”):
NSNavPanelExpandedStateForSaveMode = 1;
NSPreferencesContentSize = "{508, 413}";
NSPreferencesSelectedIndex = 6;
"NSToolbar Configuration BrowserWindowToolbarIdentifier" = {
"TB Display Mode" = 2;
"TB Icon Size Mode" = 1;
"TB Is Shown" = 1;
"TB Item Identifiers" = (
BackForwardToolbarIdentifier,
HomeToolbarIdentifier,
InputFieldsToolbarIdentifier
);
"TB Size Mode" = 1;
"TB Visibility Priority Values" = {
BackForwardToolbarIdentifier = (
999
);
InputFieldsToolbarIdentifier = (
1000
);
};
};
我在shell脚本中使用以下命令:
defaults write com.apple.file key keyvalue
因此,每次我想要更改“TB项标识符”时,我都在修改整个“NSToolbar Configuration BrowserWindowToolbarIdentifier”。如何直接修改plist子键或子子键?
答案 0 :(得分:3)
defaults write com.yourcompany.app key -dict-add subkey plistValue
答案 1 :(得分:2)
使用PlistBuddy
/ usr / libexec / PlistBuddy -c“set Key:SubKey1:SubKey2:Subkey3 value”./ Path/To/Your.plist