码迷,mamicode.com
首页 > 系统相关 > 详细

shell-md5sum

时间:2017-10-19 12:49:49      阅读:165      评论:0      收藏:0      [点我收藏+]

标签: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” 博客,谢绝转载!

shell-md5sum

标签:md5sum

原文地址:http://12187655.blog.51cto.com/12177655/1974019

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!