~drscream

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

Send your comment by mail.