if条件下的命令

时间:2016-04-08 13:31:54

标签: linux shell scripting command

我不熟悉脚本

任何人都可以帮我解决下面脚本的问题。我收到了一个错误。

if `tail -2 jeevagan/sample/logs.txt | head -1 | grep "Start Outputing Report"` = TRUE && `tail -1 jeevagan/sample/logs.txt | grep "Start Outputing Report"` = TRUE

then
        echo "report error"
else
        echo "report good"
fi

在日志文件中,我有以下日志:

2016-04-07 06:57:36,248 INFO : Finished Outputing Report:, Format:EXCEL, Locale: en_IN
2016-04-07 07:06:52,812 INFO : Start Outputing Report:, Format:EXCEL, Locale: en_IN
2016-04-07 06:52:56,451 INFO : Finished Outputing Report:, Format:EXCEL, Locale: en_IN
2016-04-07 06:52:56,451 INFO : Finished Outputing Report:, Format:EXCEL, Locale: en_IN
2016-04-07 07:06:52,812 INFO : Start Outputing Report:, Format:EXCEL, Locale: en_IN
2016-04-07 07:06:52,812 INFO : Start Outputing Report:, Format:EXCEL, Locale: en_IN
2016-04-07 07:06:52,812 INFO : Start Outputing Report:, Format:EXCEL, Locale: en_IN

0 个答案:

没有答案