[英]How to execute the "help" Linux command on Android?
我想運行像am -help
這樣的命令並獲取該命令的使用信息。 但是, -help
參數似乎不適用於 Process Runtime。 如何使這項工作?
cmd1[0] = "/system/bin/sh";
cmd1[1] = "-c";
cmd1[2] = "/system/bin/am -help" //I want to do sth like this
Process process = Runtime.getRuntime().exec(cmd1);
該命令無需-help
。 有沒有辦法獲取 Android Shell 命令的使用信息和/或語法? 請注意,如果我不發送am -help
而只是發送命令am
那么它會自動返回該命令的使用信息。 有沒有辦法以任何其他方式調用該響應?
#!/system/bin/sh
curl -s http://man.he.net/?topic=$1\§ion=all | tail -n +10 | head -n -9
將其保存在 xbin 中(我們稱之為 hlp.sh)然后只是hlp.sh cat
,您將獲得 cat 的幫助文檔.. 您只需要先安裝 curl 並且還需要互聯網連接 ..
我希望我沒有誤解你想要做什么。 但是你聽說過 man 命令嗎? 例如,如果您想運行 gparted,您可以輸入man gparted
並獲取有關該程序的文檔。 --help
不像您在手冊頁中找到的信息那么全面。
您無需 root 即可使用man
命令。
編輯:我的錯。 https://android.stackexchange.com/questions/2149/where-can-i-find-documentation-for-shell-commands我認為你不能在 Android 上使用 man 命令。 那太糟糕了。 不過,請檢查該鏈接,有一些有趣的答案。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.