#!/bin/bash ntpdateasia.pool.ntp.org&>/dev/null date=$(date+%y%m%d) size=$(du-sh/etc) if [-d/lee/bak] then echo"Date:$dateSize:$size">>/lee/bak/bakinfo.txt cd/lee/bak#可以省略 tar-zcfetc_$date.tar.gz-C/lee/bak/etc&>/dev/null else mkdir/lee/bak echo"Date:$dateSize:$size">>/lee/bak/bakinfo.txt cd/lee/bak#可以省略 tar-zcfetc_$date.tar.gz-C/lee/bak/etc&>/dev/null fi原文链接:https://www.f2er.com/bash/392824.html