使用多参数调用exec(否则您可能会被转义规则咬住)。同样,由于您不是从shell脚本调用的,因此无需转义分号:
Process pr = rt.exec(new String[]{"find", "testDir", "-type", "f", "-exec", "md5sum", "{}", ";"});
使用多参数调用exec(否则您可能会被转义规则咬住)。同样,由于您不是从shell脚本调用的,因此无需转义分号:
Process pr = rt.exec(new String[]{"find", "testDir", "-type", "f", "-exec", "md5sum", "{}", ";"});