import java.io.IOException;
import java.io.InputStreamReader;
import java.io.LineNumberReader;
public class RunShell {
public static void main(String[] args) {
try {
///opt/flow_video/flow_total.sh 2011-05-26 11:08:02 12:08:07 192.168.1.152,192.168.1.153
Process process = Runtime.getRuntime().exec("/opt/flow_video/tf.sh 2011-05-23 11:08:02 12:08:07");
InputStreamReader ir = new InputStreamReader(process.getInputStream());
LineNumberReader input = new LineNumberReader(ir);
String line;
while ((line = input.readLine()) != null)
System.out.println(line);
input.close();
ir.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
java调用shell,并得到shell的输出
最新推荐文章于 2023-12-07 13:33:11 发布