#!/bin/bash ################################################################################ # ident "@(#) make something like dircmp(1) to do directory compare using diff(1)" ################################################################################ OLD="$1" NEW="$2" #OLDB=`basename $1` OLDB="${1##*/}" # This is the Bash equivalent of basename #NEWB=`basename $2` NEWB="${2##*/}" # This is the Bash equivalent of basename if [ "$OLDB" = "$NEWB" ] then OLDB=`echo $OLD |sed -e 's@/$OLDB$@@'` NEWB=`echo $NEW |sed -e 's@/$NEWB$@@'` fi OLDB_LEN=`echo "$OLDB"|wc -c` NEWB_LEN=`echo "$NEWB"|wc -c` LEN=$((OLDB_LEN)) [ $((LEN)) -lt $((NEWB_LEN)) ] && LEN=$((NEWB_LEN)) OLDB=`printf "%-${LEN}.${LEN}s:" $OLDB` NEWB=`printf "%-${LEN}.${LEN}s:" $NEWB` if [ -f "$OLD" ] then shift 1 diff \ --old-line-format="$NEWB<: %L" \ --new-line-format="$OLDB>: %L" \ --unchanged-line-format='' \ --to-file=$OLD \ -w \ --ignore-blank-lines \ --ignore-space-change \ --width=132 \ --minimal \ --recursive --report-identical-files $* ################################################################################ else diff \ -w \ --ignore-blank-lines \ --ignore-space-change \ --width=132 \ --minimal \ --recursive --report-identical-files $*| sed -e "s@^>@$NEWB>:@" -e "s@^<@$OLDB<:@" # --brief \ # --ignore-tab-expansion \ fi exit ################################################################################