|
|
1.1 ! root 1: PATH=/bin:/usr/bin ! 2: trap "rm -f /usr/tmp/dc$$*;exit" 1 2 3 15 ! 3: while [ $# -ge 2 ] ! 4: do ! 5: case $1 in ! 6: -d) Dflag="yes" ! 7: shift ! 8: ;; ! 9: -s) Sflag="yes" ! 10: shift ! 11: ;; ! 12: -*) echo unknown option ! 13: exit 3 ! 14: ;; ! 15: *) D1=$1 D2=$2 ! 16: break ! 17: ;; ! 18: esac ! 19: done ! 20: if [ $# -lt 2 ] ! 21: then echo $0: usage: $0 -s -d directory directory ! 22: exit 1 ! 23: elif [ ! -d "$D1" ] ! 24: then echo $D1 not a directory ! ! 25: exit 2 ! 26: elif [ ! -d "$D2" ] ! 27: then echo $D2 not a directory ! ! 28: exit 2 ! 29: fi ! 30: D0=`pwd` ! 31: cd $D1 ! 32: find . -print | sort > /usr/tmp/dc$$a ! 33: cd $D0 ! 34: cd $D2 ! 35: find . -print | sort > /usr/tmp/dc$$b ! 36: comm /usr/tmp/dc$$a /usr/tmp/dc$$b | sed -n \ ! 37: -e "/^ /w /usr/tmp/dc$$c" \ ! 38: -e "/^ [^ ]/w /usr/tmp/dc$$d" \ ! 39: -e "/^[^ ]/w /usr/tmp/dc$$e" ! 40: rm -f /usr/tmp/dc$$a /usr/tmp/dc$$b ! 41: pr -h "$D1 only and $D2 only" -m /usr/tmp/dc$$e /usr/tmp/dc$$d ! 42: rm -f /usr/tmp/dc$$e /usr/tmp/dc$$d ! 43: sed -e s/..// < /usr/tmp/dc$$c > /usr/tmp/dc$$f ! 44: rm -f /usr/tmp/dc$$c ! 45: cd $D0 ! 46: while read a ! 47: do ! 48: if [ -d $D1/$a ] ! 49: then if [ "$Sflag" != "yes" ] ! 50: then echo "directory $a" ! 51: fi ! 52: elif [ -f $D1/$a ] ! 53: then cmp -s $D1/$a $D2/$a ! 54: if [ $? = 0 ] ! 55: then if [ "$Sflag" != "yes" ] ! 56: then echo "same $a" ! 57: fi ! 58: else echo "different $a" ! 59: if [ "$Dflag" = "yes" ] ! 60: then diff $D1/$a $D2/$a | pr -h "diff of $a in $D1 and $D2" >> /usr/tmp/dc$$g ! 61: fi ! 62: fi ! 63: elif [ "$Sflag" != "yes" ] ! 64: then echo "special $a" ! 65: fi ! 66: done < /usr/tmp/dc$$f | pr -r -h "Comparison of $D1 $D2" ! 67: if [ "$Dflag" = "yes" ] ! 68: then cat /usr/tmp/dc$$g ! 69: fi ! 70: rm -f /usr/tmp/dc$$*
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.