#!/bin/sh #Author: Opal TODAY=`date +%Y%m%d` YESTERDAY=`date -d"-1 day" +%Y%m%d` mkdir -p /var/backups/etc.${TODAY}/ cp -r /etc/* /var/backups/etc.${TODAY}/ DIFF=`diff -r /var/backups/etc.${TODAY}/ /var/backups/etc.${YESTERDAY}/` if [$DIFF = ""];then rm -rf /var/backups/etc.${YESTERDAY} else echo "Some file have changed!" fi
原文:http://www.cnblogs.com/opalyao/p/3906551.html