I have a bash script where I'm pulling the date from the last line of a text file, adding 1 day to the time and then writing that date back to the file. The idea is to add 24 hours each time. My code look like the following:
start_date=$(date -d "$(tail -n 1 run_dates.txt) +1 day" '+%F %T')
echo "$start_date" >> run_dates.txt
The output file (run_dates.txt) looks like this:
2018-09-18 16:42:57
2018-09-19 11:42:57
2018-09-20 06:42:57
2018-09-21 01:42:57
2018-09-21 20:42:57
For some reason it is only adding 19 hours every time, not a full day. Any idea what this is?