#!/bin/bash yesterday=`date -d last-day +%Y-%m-%d` dayago=`date -d '2 days ago' +%Y-%m-%d` #echo $yesterday yester=`grep 'createOrderPayByQrcode.in' /opt/nginx/logs/all_access.$yesterday |wc -l` oldday=`grep 'createOrderPayByQrcode.in' /opt/nginx/logs/all_access.$dayago |wc -l` chayi=`expr $yester - $oldday` echo '昨天交易的笔数为:'$yester ' 前天交易的笔数为:'$oldday ' 两者相差为:'$chayi '笔交易!'