我想在GROOVY腳本中實現以下,但出現錯誤: 讀取數組中的HTML文件的內容,然後grep
爲該數組中的某些內容讀取內容。Groovy:讀取數組中的文件的內容並grep的東西
def file1 = new File("/path/to/the/file/xyz.html");
def lines = file1.readLines()
if ((-e "/path/to/the/file/xyz.html") and (!(grep /jira.bugtracker.com/, lines))
{
println (" the changes are present\n");
exit 0;
}
else
{
println (" the changes are not present\n");
exit 1;
}
請檢查代碼並提出正確的方法。
你得到了什麼錯誤?這是在詹金斯文件的上下文中嗎?你可以發佈嗎? – burnettk