分类:
2008-11-15 15:38:19
#!/bin/bash sources=/tmp/max if [ -z $1 ];then echo "Usage dbf.sh (file | tar) @@" exit 3 else : fi if [ $1 == "tar" ];then tar czvf /tmp/max-`date +%y%d%H%M`.tar.gz /tmp/max 2&> /dev/null rm -rf /tmp/max 2&> /dev/null exit 0 fi if [ -d /tmp/max ];then : else mkdir $sources fi file=`ls $1 | awk -F/ '{print $NF}'` if [ -f "$file".bak ];then : else cp $1 $sources/"$file".bak fi vi $1 if [ -f $sources/d-"$file" ];then echo "" >> $sources/d-"$file" echo "" >> $sources/d-"$file" echo "################################################################" >> $sources/d-"$file" diff $1 $sources/"$file".bak >> $sources/d-"$file" echo "################################################################" >> $sources/d-"$file" else diff $1 $sources/"$file".bak >> $sources/d-"$file" fi |