vi dws_uv.sh
echo '日期为:'$d
echo '开始计算周一和周日'
current_d=` date -d "$d" +%w`
#echo $current_d
if [ $current_d -eq 0 ]
then
echo '当前日期为周日'
sun_m=0
mon_m=6
else
let mon_m=$current_d-1
let sun_m=7-$current_d
fi
#echo $mon_m,$sun_m
mon_d=`date -d "$d -$mon_m day" +%Y-%m-%d `
sun_d=`date -d "$d +$sun_m day" +%Y-%m-%d `
echo '周一为:'${mon_d}, '周日为:' ${sun_d}
然后运行脚本