日期化脚本
#!/bin/bash . /etc/profile if [ $# == 0 ]; then SDATE=$(date "+%F" -d "-1 days") EDATE=$(date "+%F" -d "-1 days") elif [ $# == 1 ]; then SDATE=$1 EDATE=$1 else SDATE=$1 EDATE=$2 fi halfmonthago=$(date "+%F" -d "-15 days") bin=$(cd `dirname $0`;pwd) home=$(dirname $bin) NDATE=$SDATE a=`date -d "-0 day $EDATE" +%s` b=`date -d "-0 day $SDATE" +%s` key=$(($a-$b)) key=$((key/86400)) key=$((key+1)) echo "work number is" $key for ((i=0;i<key;i++ )) do python $bin/stat.py $home 2016-07-12 NDATE=$(date "+%F" -d "+1 days $NDATE") done