Get yesterday's date in bash on Linux, DST-safe
Solution 1:
I think this should work, irrespective of how often and when you run it ...
date -d "yesterday 13:00" '+%Y-%m-%d'
Solution 2:
Under Mac OSX date works slightly different:
For yesterday
date -v-1d +%F
For Last week
date -v-1w +%F
Solution 3:
This should also work, but perhaps it is too much:
date -d @$(( $(date +"%s") - 86400)) +"%Y-%m-%d"