0
我得到null作爲此命令行的輸出。如何在java Runtime.exec中使用管道
Process result = Runtime.getRuntime().exec(new String[]{"/usr/bin/find",baseDir+"/..","-type","f","|","/usr/bin/grep",filter1,"|","/usr/bin/grep",filter2,"|","/usr/bin/wc","-l"});
result.waitFor();
BufferedReader echo = new BufferedReader(new InputStreamReader(result.getInputStream()));
writer.print(echo.readLine());
echo.close();
它是管道「|」嗎?
http://stackoverflow.com/questions/5928225/how-to-make-pipes-work-with-runtime-exec –