标签:md5sum
#!/bin/bash
ordsumfile=/tmp/sum.txt
#Ordfirst=$(cat $ordsumfile|awk ‘{print $1}‘)
#----------------------->definition find file list
AA=(
$(find /etc/ -name *.conf)
)
#----------------------->definition find match file true and false
sumtrue=/tmp/sumtrue.txt
sumfalse=/tmp/sumfalse.txt
>$sumtrue && >$sumfalse
for ((i=0;i<${#AA[@]};i++ ))
do
ValueSumfile=$(echo $(md5sum ${AA[$i]})|awk ‘{print $1}‘)
Valuefile=$(echo $(md5sum ${AA[$i]})|awk ‘{print $2}‘)
grep $ValueSumfile $ordsumfile &>/dev/null
if [ $? -eq 0 ];then
echo "${AA[$i]} ----> values not change!" >>$sumtrue
echo "-----------------------------------------------------------------">>$sumtrue
else
grep $Valuefile $ordsumfile &>/dev/null
if [ $? -eq 0 ];then
echo "${AA[$i]} ----> values change!" >>$sumfalse
echo "-----------------------------------------------------------------" >>$sumfalse
else
echo "${AA[$i]} ----> find file in ord file not exist,is new file!" >>$sumfalse
echo "-----------------------------------------------------------------" >>$sumfalse
fi
fi
done
本文出自 “12177655” 博客,谢绝转载!
标签:md5sum
原文地址:http://12187655.blog.51cto.com/12177655/1974019