我正在寻找从tripwire报告中获取数值,如果该值大于0,请发送电子邮件。到目前为止的脚本如下所示:
#!/bin/bash
tripwire --check > /tmp/twreport
count=grep 'Total violations found: 0' /tmp/twreport
if [ $count < 1 ]; then
mail -s "[tripwire] Report for `uname -n`" user@example.com < /tmp/twreport
fi
不确定如何获取该值并将其设置为变量,或者是否有办法将其包含在 if 语句本身中。