Title: using diff, cmp, comm, etc.

Hello all,

Take a look at the following script (alteration of the one Anthony Greene was kind enough to offer up to me).  My question: is there a way to use something like diff, cmp, comm or such to return a list of the differences (line by line) between 2 files?  The current script simply sends the current directory listing, my preference would be to send the only the differences between the current and previous copies.

# Compare the previous and current directory listings.
if cmp -s /etc/ftpradiolsnew /etc/ftpradiolsold
then
   # The FTP radio directory listing has not changed, update listing only.
   rm -rf /etc/ftpold
   cp /etc/ftpnew /etc/ftpold
else
   # The directory listing has changed, send an e-mail notification & update listing.
   cat /etc/ftpnew | mail -s "updated FTP radio spot list" [EMAIL PROTECTED]
   rm -rf /etc/ftpold
   cp /etc/ftpnew /etc/ftpold
fi

Feel free to make any other suggestions (improvements) to what I've done here...it's kinda crude, but it does what I want (almost).

Thanks in advance!

Stuart

Reply via email to