#!/bin/bash FILE=/usr/local/mysql FILESIZE=`du -s $FILE| awk '{print $1}'`|cut -f 1 -d 'M' if [ $FILESIZE -gt 20 ]; then echo "the file size is more than the primary file" else echo "the file size is less than the primary file"
实现代码如下: #!/usr/bin/python #*-*coding:utf8*-* import os import sys import hashlib def md5sum(data): with open(data, "rb") as f: md5 = hashlib.md5() #赋空值 for i in f.read(4096): #防止遇到大文件打开太占用内存,所以一次打开4096字节 if