我从多个 plist 中获取了多个字典。在我将它们保存在一个对象中之后说数组。现在我必须将这个数组合并或写入新的 plist。有什么命令可以做到这一点吗?我尝试了很多,无法写。
target_directory="$(pwd)"/OnePlist/
mkdir $target_directory
find . -name 'feature-manifest.plist' |
{
while read line; do
cp -- "$line" $target_directory ;
#/usr/libexec/PlistBuddy
array+=$(/usr/libexec/PlistBuddy -c "print :ModulePlugin:" $line)
echo "echo value: $array"
done
echo "Total files in array : $array"
echo "Total files in array : ${#array[*]}"
从上面的脚本中,我正在将 ModulePlugin Dict 写入不同文件夹中多个 plist 的数组,我想将此数组写入新的 plist 。有什么命令可以做到这一点吗?
Out put : Total files in array : Dict {
StoreLocator = Dict {
Status = Active
IconText = Store Locator
InfoPage = StoreLocatorInfo.html
id = 6
Priority = 6
StoryBoard = StoreLocator
RootViewController = StoreLocatorViewController
Icon = Images.bundle/HomeScreenIcons/store_locater.png
}
}Dict {
Scanner = Dict {
Status = Active
IconText = Scanner
InfoPage = ScannerInfo.html
id = 6
Priority = 6
StoryBoard = Scanner
RootViewController = ScannerViewController
Icon = /HomeScreenIcons/multi_scan@2x.png
}
}Dict {
Coupons = Dict {
Status = Active
IconText = Coupons
InfoPage =
id = 4
Priority = 4
StoryBoard = Coupons
RootViewController = CouponsViewController
Icon = /HomeScreenIcons/coupons@2x.png
}
}Dict {
StoreLocator = Dict {
Status = Active
IconText = Store Locator
InfoPage = StoreLocatorInfo.html
id = 6
Priority = 6
StoryBoard = StoreLocator
RootViewController = StoreLocatorViewController
Icon = Images.bundle/HomeScreenIcons/store_locater.png
}
}
上面有多个字典的对象。我必须将 dem 写入新的 plist。