How can I email the output between file1 and file2 but only if there is a difference? Lets say I’m using a shell script.
diff file1 file2 | mail -s "subject" "email@email.com"
Advertisement
Answer
Use the || concatenation.
diff -q file1 file2 || diff file1 file2 | mail -s "subject" "email@email.com"
More info here