I'm writing a simple bash script to do the following:
1) Check two files (foo1 and foo2).
2) If foo1 is different from foo2 and foo1 NOT blank, send an email.
3) If foo1 is the same as foo2... or foo1 is blank... do nothing.
The blank condition is what's confusing me. Here's what I've got to start with:
diff --brief <(sort ./foo1) <(sort ./foo2) >/dev/null comp_value=$? if [ $comp_value -ne 0 ] then mail -s "Alert" email@example.com <./alertfoo fi
Obviously this doesn't check for blank contents. Any thoughts on how to do that?