##Date logic *sobs* function date_logic { #a not so elegant, elegant solution to the issue of month rollover. day_tmp=`date +"%d"` month_tmp=`date +"%m"` if [ $day_tmp -eq 01 ] then if [ $month_tmp -eq 01 ] || [ $month_tmp -eq 02 ] || [ $month_tmp -eq 04 ] || [ $month_tmp -eq 06 ] || [ $month_tmp -eq 08 ] || [ $month_tmp -eq 09 ] || [ $month_tmp -eq 11 ] then day=31 elif [ $month_tmp -eq 03 ] then day=28 elif [ $month_tmp -eq 05 ] || [ $month_tmp -eq 07 ] || [ $month_tmp -eq 10 ] || [ $month_tmp -eq 12 ] then day=30 fi else day=$(( $day_tmp - 1 )) fi }