Last active
December 16, 2015 20:09
-
-
Save mgamba/5490154 to your computer and use it in GitHub Desktop.
iterate backwards from today to $DATE
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
d=0 | |
until [ $DATE = `date -d "-$d days" +%Y/%m/%d` ]; do | |
let d+=1 | |
if [ 2011/07/14 = `date -d "-$d days" +%Y/%m/%d` ]; then | |
echo "fail - date $DATE_STRING not in acceptable range (2012/07/15-current)" >&2 | |
exit -1 | |
fi | |
done | |
for days_back in {1..4}; do | |
d+=$days_back | |
daily_stats_date=`date -d "-$d days" +%Y/%m/%d` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment