the following will do:
date -d "$(date +%Y-%m-1) -1 month" +%-m
date -d "$(date +%Y-%m-1) 0 month" +%-m
date -d "$(date +%Y-%m-1) 1 month" +%-m
or as you need:
LAST_MONTH=`date -d "$(date +%Y-%m-1) -1 month" +%-m`
NEXT_MONTH=`date -d "$(date +%Y-%m-1) 1 month" +%-m`
THIS_MONTH=`date -d "$(date +%Y-%m-1) 0 month" +%-m`
you asked for output like 9,10,11, so I used the %-m
%m
(without -) will produce output like 09,... (leading zero)
this also works for more/less than 12 months:
date -d "$(date +%Y-%m-1) -13 month" +%-m
just try
date -d "$(date +%Y-%m-1) -13 month"
to see full result