我正在尝试执行下面的代码,但没有获得cksum
值。如何使用Runtime.getRuntime().exec()
命令获取此值。我有限制使用ProcessBuilder
类。
public static void main(String[] args){
Process p;
String strJob = "/abc/xyz/scripts/report.ksh";
try {
p = Runtime.getRuntime().exec(new String[]{"ksh","cksum ","/data/p2p/monitor/scripts/Apps_filesystem_report.ksh"});
BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream()));
while ((str = input.readLine()) != null) {
System.out.println("Hello World!"+input.readLine());
}
}catch (IOException e) {
e.printStackTrace();
}
}