簡體   English   中英

如何在 Android 上執行“幫助”Linux 命令?

[英]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\&section=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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM