I have a process that uses the current day and previous day to find files.
currentday=$(date -d "$D" '+%d')
prevday=$(date -d "1 day ago" '+%d')
when this runs on the first of the month it does not return 01 for the current day. It gave an error 'invalid date'. When it ran on the second it does show 01 for the previous day.
how do I determine the first day of the month?