Bash, get the last day of the month

Easy way to get the last day is to look if the next day is the first of the month. Now here are a small bash script thats show you the functionality:

if [ $(date -d tomorrow +%d) -eq 1 ]; then
    echo "OK: last day of the month"
else
    echo "NOK: not the last day of the month"
fi

Posted

January 27, 2008, 9:59 pm

Tags

,

More

Permalink

Comments

Send your comment by mail.