Skip to content

Instantly share code, notes, and snippets.

@mgamba
Last active December 16, 2015 20:09
Show Gist options
  • Save mgamba/5490154 to your computer and use it in GitHub Desktop.
Save mgamba/5490154 to your computer and use it in GitHub Desktop.
iterate backwards from today to $DATE
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