I need to find 1 month ago from a particular date. But for months with 31 days, I'm getting in-correct date as the output
For example, in the scenario below I should have got 20191130, but I got 20191201 as the output
curr_date=20191231
prev_month_date=$(date -d "$curr_date - 1 month" +%Y%m%d)
echo $prev_month_date
20191201