User Tools

Site Tools


bash:one_liners:find_last_day_of_the_month

This is an old revision of the document!


I needed to find the last Sunday of the month in relation to a backup script. This is the result:

ncal -h 2>&1 | awk '/Su/ {print $(NF)}'

Finding the amount of days can be done like this:

date -d "`date +%m`/1 + 1 month - 1 day" "+%d";
bash/one_liners/find_last_day_of_the_month.1412579462.txt.gz · Last modified: 2015/08/15 22:56 (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki