【问题标题】:chmod android file system from script来自脚本的 chmod android 文件系统
【发布时间】:2014-08-22 01:43:49
【问题描述】:

出于某些测试目的,我正在使用在 vmware fusion 中运行的 Android-x86 vm。我通过adb push 将文件推送给它,但是,每次我卸载并重新安装应用程序时,我都必须执行以下操作:

adb shell
su
chmod 777 /my/path
exit
exit

我需要能够编写整个过程的脚本,但我不确定如何通过某种脚本来管理 chmod 过程。我尝试做类似的事情

adb shell am chmod 777 /my/path

但这不起作用。我以为会的,因为我能做到

adb shell am start ...

我也试过了:

adb shell "su && chmod 777 /my/path && exit && exit"

这确实有效,但不会退出 shell 进程。因此,非常感谢任何建议。

【问题讨论】:

    标签: android shell chmod


    【解决方案1】:

    您可以将命令传递给 adb shell,正如您所提到的,但如果您将命令用引号括起来,效果会更好。

    同样,您可以使用 -c 参数将命令传递给“su”命令。将所有这些加在一起,它应该可以在一个漂亮的单衬里做你想做的事!

    adb shell "su -c 'chmod 777 /my/path'"
    

    【讨论】:

      猜你喜欢
      • 2012-04-29
      • 1970-01-01
      • 1970-01-01
      • 2018-10-20
      • 2022-11-08
      • 2011-07-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多