我正在處理需要解析ps命令返回的數據的腳本。在Redhat/Centos上,我知道它很容易指定列分隔符,但是與BSD version of PS一樣,它並不那麼簡單。 我知道這將有可能使用awk,sed或tr以取代任何字符空間,但可以說的格式有args或comm中間的某個位置,輸出將是: $ ps -o pid,ppid,args,user | head
PID PPID ARGS
我想在我的Android應用程序執行ps命令,因爲這樣的: try {
Process process = Runtime.getRuntime().exec("ps");
BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
int r