md5_check.sh 检测文件MD5是否一致

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

#!/bin/bash
# author: sean.tangx
#
# function: check md5sum

[ $# -eq 0 ] && exit

item=$(md5sum $1|awk '{print$1}')
case $# in
1)
        echo -e "\033[36m$item\033[0m" ;;
2)
        [ $item == $2 ] && echo -e "\033[32m$item\033[0m" || echo -e "\033[31m$item\033[0m" ;;
*)
        echo "Usage: $0 file [given_md5]
        ;;
esac