【发布时间】:2021-06-04 18:12:02
【问题描述】:
对于涉及通过 ADB shell 以用户 ceres 身份发出 dconf 命令的 bash 脚本,我需要嵌套多个命令。 以下三个命令的手动顺序执行完美无缺。
adb shell
su ceres
dconf write /desktop/asteroid/watchface "'file:///usr/share/asteroid-launcher/watchfaces/$opt.qml'"
我学会了转义 dconf 关键字以正确地将 dconf 嵌套在 su ceres -c '<command>' 中。
su ceres -c 'dconf write /desktop/asteroid/watchface \"'file:///usr/share/asteroid-launcher/watchfaces/$opt.qml'\"'
如何将上面的命令嵌套和转义到adb shell "<command>"?
adb shell "su ceres -c 'dconf write /desktop/asteroid/watchface \"'file:///usr/share/asteroid-launcher/watchfaces/$opt.qml'\"'"
当从 bash 脚本发出时,会导致 dconf 回复 error: 0-4:unknown keyword。
感谢您的帮助和解释!
【问题讨论】: