如何在 Android shell 中复制和编辑文件? [英] How to copy and edit files in Android shell?
问题描述
Android shell 没有 cp 命令.Android shell 也没有 sed 或 grep 或 vi.我没有可用的 adb 守护程序.有 mv 命令,但如果源位于只读设备上,它会拒绝工作.
The Android shell does not have the cp command. Android shell also has no sed or grep or vi. I have no adb daemon available. There is mv command but it rejects to work if source is on a read-only device.
- 如果我必须从只读设备递归复制一些目录怎么办?
- 如何更改文本文件中的一行(例如PATH=/cache"为PATH=/mnt/asec")?
推荐答案
对此最常见的答案很简单:将几个应用程序(busybox?)与您的 APK 捆绑在一起(假设您想在应用程序中使用它).据我所知,/data 分区没有挂载 noexec,即使你不想部署一个成熟的 APK,你也可以修改 ConnectBot 源来构建一个包含一组命令行工具的 APK.
The most common answer to that is simple: Bundle few apps (busybox?) with your APK (assuming you want to use it within an application). As far as I know, the /data partition is not mounted noexec, and even if you don't want to deploy a fully-fledged APK, you could modify ConnectBot sources to build an APK with a set of command line tools included.
对于命令行工具,我建议使用 crosstool-ng 并构建一组静态链接工具(链接到 uClibc).它们可能很大,但它们肯定会起作用.
For command line tools, I recommend using crosstool-ng and building a set of statically-linked tools (linked against uClibc). They might be big, but they'll definitely work.
这篇关于如何在 Android shell 中复制和编辑文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!