标签: linux email unix diff
如何通过电子邮件发送file1和file2之间的输出,但仅限于存在差异?可以说我正在使用shell脚本。
diff file1 file2 | mail -s "subject" "email@email.com"
答案 0 :(得分:1)
使用||串联。
diff -q file1 file2 || diff file1 file2 | mail -s "subject" "email@email.com"
更多信息here
答案 1 :(得分:0)
我能够在网上找到它,效果很好
command > file if [ -s file ] then mailx -s "Subject" mailaddress <file.tmp fi rm file