#!/bin/bash
if [ ${month} -gt 9 ];then
end=2015${month}16
else
end=20150${month}16
fi
if [ ${lastmonth} -gt 9 ];then
start=2015${lastmonth}16
else
start=20150${lastmonth}16
fi
#echo $end
#echo $start
count=0
end_day=`date -d "$end" +%s`
start_day=`date -d "$start" +%s`
delm=$[$end_day-$start_day]
day_num=$[$delm /84000]
n=${day_num}
weekend_str=""
day_str=`date -d "$n days ago $end" +%Y%m%d`
let count=count+1
for ((i=$n-1;i>=1;i--));do
day=`date -d "$i days ago $end" +%Y%m%d`
day_flag=`date -d $day +%w`
if [ $day_flag -eq 0 -o $day_flag -eq 6 ];then
weekend_str=$weekend_str,${day}
continue
fi
let count=count+1
day_str=$day_str,$day
done
end=`date -d "1 days ago $end" +%Y%m%d`
echo ${start}"--"${end}" 如果没有法定节假日或者调休"
echo
echo "共"$count"天"
echo -e "上班日\t"$day_str
echo
echo -e "休息日\t"$weekend_str
#sh create_work_day.sh 10 即可打印出9月中旬到10月中旬的工作日
month=$1
let lastmonth=${month}-1if [ ${month} -gt 9 ];then
end=2015${month}16
else
end=20150${month}16
fi
if [ ${lastmonth} -gt 9 ];then
start=2015${lastmonth}16
else
start=20150${lastmonth}16
fi
#echo $end
#echo $start
count=0
end_day=`date -d "$end" +%s`
start_day=`date -d "$start" +%s`
delm=$[$end_day-$start_day]
day_num=$[$delm /84000]
n=${day_num}
weekend_str=""
day_str=`date -d "$n days ago $end" +%Y%m%d`
let count=count+1
for ((i=$n-1;i>=1;i--));do
day=`date -d "$i days ago $end" +%Y%m%d`
day_flag=`date -d $day +%w`
if [ $day_flag -eq 0 -o $day_flag -eq 6 ];then
weekend_str=$weekend_str,${day}
continue
fi
let count=count+1
day_str=$day_str,$day
done
end=`date -d "1 days ago $end" +%Y%m%d`
echo ${start}"--"${end}" 如果没有法定节假日或者调休"
echo
echo "共"$count"天"
echo -e "上班日\t"$day_str
echo
echo -e "休息日\t"$weekend_str