I have the following entry in cron:
0 0 * * * /path/to/script.sh
in script.sh
, there's a call to:
date +%Y%m%d
Even if this executed in zero-time, I'm assuming that the value of date will be for the date after midnight, rather than the date before. Is that correct?
Yes, you are correct once the clock hits 00:00:00 date = date +1
However, if you really wanted it to be the day before you could do this in your date command:
date "yesterday" +%Y%m%d
Yes. Computers view 00:00.00 as the start of a new day, so it will be for the date after midnight, not the date before.