管道是shell的功能-您没有使用shell,而是在执行进程(
ps)。
但实际上,您为什么要这样做?您的意思是:
“执行ps,然后将其输出通过管道传送到另一个程序(grep),并提取我需要的内容”
您只需要从的输出中提取想要的内容即可
ps。使用
Matcher,只注意
java您的
InputStream
http://download.oracle.com/javase/6/docs/api/java/util/regex/Matcher.html

管道是shell的功能-您没有使用shell,而是在执行进程(
ps)。
但实际上,您为什么要这样做?您的意思是:
“执行ps,然后将其输出通过管道传送到另一个程序(grep),并提取我需要的内容”
您只需要从的输出中提取想要的内容即可
ps。使用
Matcher,只注意
java您的
InputStream
http://download.oracle.com/javase/6/docs/api/java/util/regex/Matcher.html