1、遍历给定工夫范畴内的日期
#! /bin/bash
start_date=2021.01.01
end_date=2021.01.30
start_sec=`date -d "$start_date" "+%s"`
end_sec=`date -d "$end_date" "+%s"`
for((i=start_sec;i<=end_sec;i+=86400)); do
day=$(date -d "@$i" "+%Y.%m.%d")
echo $day
done
1、遍历给定工夫范畴内的日期
#! /bin/bash
start_date=2021.01.01
end_date=2021.01.30
start_sec=`date -d "$start_date" "+%s"`
end_sec=`date -d "$end_date" "+%s"`
for((i=start_sec;i<=end_sec;i+=86400)); do
day=$(date -d "@$i" "+%Y.%m.%d")
echo $day
done