Am 15.03.2017 um 16:53 schrieb Pádraig
Brady:
"coreutils FAQ"
By the way, I think there is a typo:
$ date --date="$(date +%Y-%m-15) -1 month" +'Last month was %B.'
Last month was June.
$ date --date="$(date +%Y-%m-15) +1 month" +'Next month will be %B.'
Next month will be May.
Compared with:
$ thismonth=$(date --date="@$now" "+%Y-%m-15 12:00")
$ echo "LastMonth=$(date -d "$thismonth 1 month ago" +%B), NextMonth=$(date -d "$thismonth 1 month" +%B)."
LastMonth=March, NextMonth=May.
I assume, in the first example, it should be:
Last month was *March*.
-Ulf