home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / c / cops_104.zip / cops_104 / extra_src / diff_last.sh < prev    next >
Linux/UNIX/POSIX Shell Script  |  1992-03-10  |  1KB  |  42 lines

  1. #!/bin/csh -f
  2. #
  3. # Now for the good news: below is yet another little COPS accessory
  4. # script.  As you will recall, I keep a number of COPS reports around in
  5. # a subdirectory named after the host.  This script will find the last
  6. # two and do a diff on them.  I've wondered whether I should take this a
  7. # step further and use something like this as the basis for the mailed
  8. # report, but that might make it too easy to miss things.  Still, this
  9. # script seems to be useful when I get a COPS report in the mail and I
  10. # can't see that anything important has changed.  Enjoy.
  11. # -- Prentiss Riddle ("aprendiz de todo, maestro de nada") riddle@rice.edu
  12. # -- Unix Systems Programmer, Office of Networking and Computing Systems
  13. # -- Rice University, POB 1892, Houston, TX 77251 / Mudd 208 / 713-285-5327
  14. # -- Opinions expressed are not necessarily those of my employer.
  15. #
  16. #  difflast - do a diff on the last two COPS reports for a specific host
  17. #
  18. #  Usage:  difflast [host-directory]
  19. #
  20. #
  21. #  History:
  22. #  11/25/91  P.Riddle  Original version.
  23. #
  24. set AWK=/bin/awk
  25. set DIFF=/bin/diff
  26. set LS=/bin/ls
  27.  
  28. set DIR="$1"
  29. if ( "x$DIR" == x ) then
  30.     set DIR=.
  31. endif
  32. if ( ! -d "$DIR" ) then
  33.     echo "difflast: directory \"$DIR\" not found."
  34.     exit 1
  35. endif
  36. set FILES=`$LS -t ${DIR}/[0-9][0-9][0-9][0-9]_[A-Z][a-z][a-z]_[0-9]* | $AWK 'NR<=2'`
  37. echo "$FILES"
  38. $DIFF $FILES
  39. exit 0
  40.