linux中shell循环获取日期

#!/bin/bash

#YESTERDAY=`date -d yesterday +%Y-%m-%d`
#echo $YESTERDAY

k=4
while((k++<=33))
do
#currentDay=`date -d yesterday +%Y-%m-%d`
currentDay=`date +%Y-%m-%d -d " $k days ago " `
echo $currentDay
done

你可能感兴趣的:(bash)