当前位置:主页 > 脚本语言 > Shell >

Shell脚本实现检测文件是否被修改过代码分享

时间:2020-10-16 12:42:20 | 栏目:Shell | 点击:

#!/bin/bash
funmd5_1() {
find /root/passwd -type f | xargs md5sum > /tmp/funmd5_1.log
}
funmd5_2() {
find /root/passwd -type f | xargs md5sum > /tmp/funmd5_2.log
}
if [ ! -f /tmp/funmd5_1.log ];then
funmd5_1
fi
funmd5_2
diff /tmp/funmd5_1.log /tmp/funmd5_2.log > /tmp/diff.log
Status=$?
if [ $Status = 0 ];then
exit
else
echo "文件修改过了!"
fi

您可能感兴趣的文章:

相关文章