第一种方法是通过cmp来进行比对
[root@localhost bo]# ls
1.html 2.html 3.html 4.html 5.html 6.html 7.html 8.html 9.html cat.sh
[root@localhost bo]# cat cat.sh
#!/bin/bash
[ ! -f /root/wyb/bo/cat.log ] && cat *.html > /root/wyb/bo/cat.log
cat *.html >tmp.log
cmp tmp.log /root/wyb/bo/cat.log
[ $? -eq 0 ] && echo yes || echo no
[root@localhost bo]# bash cat.sh
yes
[root@localhost bo]# vi 2.html
[root@localhost bo]# bash cat.
cat.log cat.sh
[root@localhost bo]# bash cat.sh
tmp.log /root/wyb/bo/cat.log differ: byte 12, line 3
no
[root@localhost bo]#
第二种方法是通过md5来检验
[root@localhost bo]# ls
1.html 2.html 3.html 4.html 5.html 6.html 7.html 8.html 9.html cat.log cat.sh md5.sh tmp.log
[root@localhost bo]# cat md5.sh
#!/bin/bash
LANG=en
dosomething()
{
a=`grep 'FAILED' /tmp/md5.check|awk -F':' '{print $1}'`
echo -e "