Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mail diff, if no difference no mail

Status
Not open for further replies.

MoreFeo

Technical User
Nov 29, 2002
547
ES
Hi, we need a script that compares 2 files, and if there are any differences mail them.
Right now we make a diff redirected to a file, and we mail that file, but this always sends a mail, even when there are no differences.
I know I have seen in one of these forums the way to do this, but right now I'm not finding the post.
How can I prevent my script from sending a mail if there are no differences?

Thanks
 
You could shorten it further to
Code:
diff /input/file1 /input/file2 > /output/file || mail me@myserver < /output/file

Ceci n'est pas une signature
Columb Healy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top