home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / boot / i386 / rescue / usr / bin / gendiff < prev    next >
Text File  |  2006-11-29  |  386b  |  20 lines

  1. #!/bin/sh
  2.  
  3. [ -z "$1" -o -z "$2" ] && {
  4. # usage
  5.   echo "usage: $0 <directory> <diff-extension>" 1>&2
  6.   exit 1
  7. }
  8.  
  9. find $1 \( -name "*$2" -o -name ".*$2" \) -print |
  10. while read f; do
  11.     U=-u
  12.     [ "`basename $f`" = "ChangeLog$2" ] && U=-U0
  13. #    diff ${U} $f `echo $f | sed s/$2\$//`
  14.     if [ -r "$f" ]; then
  15.     diff ${U} "${f}" "${f%$2}"
  16.     else
  17.     diff ${U} /dev/null "${f%$2}"
  18.     fi
  19. done
  20.