是否有用于打印 plist 内容的 shell 实用程序?最好是越狱的 iOS 设备?

Cad*_*ade 4 scripting bash ios

我需要一个在 plist 文件中打印实际文本的工具(plutil 更改格式,cat 打印乱码,iOS 没有默认命令)。它需要在脚本中,因此文本编辑器不起作用。

这就是我需要它的原因:

apps="$(find /var/mobile/Applications -name "Info.plist" | grep "\.app/Info\.plist")"
mkdir /var/mobile/rmnames
for app in $apps; do 
    newplist="$(echo $app | sed 's|/var/mobile/Applications/[^/]*/||' | sed 's|\.app/Info\.plist|.txt|')"
    #1# $app | sed 's|<string>#2#</string>|<string></string>|' > "/var/mobile/rmnames/"$newplist
    mv "/var/mobile/rmnames/"$newplist $app 
done
rm -rf /var/mobile/rmnames
Run Code Online (Sandbox Code Playgroud)

我希望这样做是删除我跳板上的所有应用商店应用名称,而不必手动完成。其中“#1#”是 plist 打印实用程序,“#2#”是用于查找 CFBundleDisplayName 的正则表达式。

另外,如果你想知道为什么我不只是得到一个这样做的 Cydia 调整,我鄙视 Mobile Substrate ..哈哈,提前谢谢!

我所说的胡言乱语的例子:

mobile:Flixster.app> cat Info.plist
bplist00?#


!"#$%&'()*+,(4567(9:;    <=>CDEVWXY[\]^_bc_CFBundleSignatureYDTSDKName_DTPlatformBuild_BuildMachineOSBuil  d_UIPrerenderedIcon_MedialetsUseTestServers_CFShortVersionString_CFBundleExecuta  ble_CFBundleIconFiles_LSRequiresIPhoneOS]NSMainNibFile^MedialetsAppID_CFBundlePackageTypeZDTSDKBuild_UIRequiresPersistentWiFi\DTXcodeBuild_NSMainNibFile~ipad_CFBundleResourceSpecificationZDTCompiler_CFBundleDisplayName_%UISupportedInterfaceOrientations~ipad_CFBundleDevelopmentRegion^DTPlatformName_CFBundleURLTypes\CFBundleName_CFBundleVersion_DTPlatformVersion_CFBundleSupportedPlatformsWDTXcode_FLXReleaseCandidate_MinimumOSVersion_CFBundleIdentifier^UIDeviceFamily_CFBundleIconFile_CFBundleInfoDictionaryVersionT????[iphoneos5.0U9A334V10K549 T5.20XFlixster?-./012XIcon.png[Icon@2x.png[Icon-72.png_Icon-Small-50.png^Icon-Small.png_Icon-Small@2x.png    ZMainWindow_(83e69fab771f958d7de70ada6ba32ff334b9eec1TAPPLU9A334    U4C199_MainWindow-iPad_ResourceRules.plist_com.apple.compilers.llvmgcc42P??@AB_#UIInterfaceOrientationLandscapeLeft_$UIInterfaceOrientationLandscapeRight_UIInterfaceOrientationPortrait_(UIInterfaceOrientationPortraitUpsideDownUen_USXiphoneos?F?GHIJ_CFBundleURLName_CFBundleURLSchemes_com.jeffreygrossman.moviesapp?  KLMNOPQRSTUXflixster\fb2558160538\fb2373897986\fb2446021478]fb55312797380\fb5769  273609\fb2352444510\fb2451978556]fb16478767641]fb87604592406\fb2532675812XFlixst  erT5.20S5.0?ZXiPhoneOST0420R10S4.0_com.jeffreygrossman.moviesapp? `aXIcon.pngS6.Qeo??????(7MXs??????)<I[o???????%+2349BIR^j~?????????? 238^????????.:CP]????????????????!?%??????:F???????.???> 
Run Code Online (Sandbox Code Playgroud)

Old*_*Pro 6

您可以file用来确定 plist 的类型以及它是否是二进制的:

 plutil -convert xml1 $file && sed /*whatever*/  $file && plutil -convert binary1 $file
Run Code Online (Sandbox Code Playgroud)

否则当然你可以sed直接在 xml 文件上使用(或 perl)。