Here is a one liner to find the number of days in previous month (works in bash and KSH)
cal $((`date '+%m'`-1)) `date '+%Y'` | grep . | fmt -1 | tail -1
Here is a one liner to find the number of days in previous month (works in bash and KSH)
cal $((`date '+%m'`-1)) `date '+%Y'` | grep . | fmt -1 | tail -1