shell脚本把昨天的txt打成tar包

 

now=`date '+%Y-%m-%d %H:%M:%S'`
echo ${now}
yestoday1=`date -d yesterday +%Y-%m-%d`
echo ${yestoday1}
yestoday2=`date '+%Y%m%d' -d '-1 days'`
echo ${yestoday2}

tar zcvf ms_${yestoday2}.tar.gz *${yestoday1}.txt

 

你可能感兴趣的:(shell脚本)