2
我一直在試圖獲得一個腳本來打印出從開始日期到當天之後的日期範圍。腳本回顯日期範圍
例子:
Backup-2011-06-14
Backup-2011-06-15
Backup-2011-06-16
都低於一想法,但並不甚至略有工作,任何想法?
start=$(date +%F --date="2011-06-14")
echo "$start"
current=$(date +%F)
echo "$current"
end=$(date +%F)
while [ "$start" != "$current" ]; do
echo backup-$(($(date --date="$start" +%F) + $(date +%s --date='1 day')))
done
可能重複:http://stackoverflow.com/questions/4351282/how-to-generate-a-sequence-of-dates-given-starting-and-ending-dates-using-awk-of/4351948#4351948 – camh