for (int i = 0; i < 10; i++) {
if (param.path != null || ("").equals(param.path)) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd");
println("cat " + param.agoPath + simpleDateFormat.format(new Date()) + "/" + param.path + i + param.suffix + " |grep " + param.keyword + " |wc -l");
String s = i + 1 + "";
println(s);
try {
String lineStr = SshUtil.exec(param.ip, param.port, param.username, param.password,
"cat " + param.agoPath + simpleDateFormat.format(new Date()) + "/" + param.path + s + param.suffix + " |grep " + param.keyword + " |wc -l", param.timeout, param.encoding);
println(lineStr);
list.add(lineStr);
} catch (Exception e) {
break;
}
}
}
catch里的break跳不出外层的for循环,有其他方法处理吗?异常了就不循环了