Wednesday, October 13, 2010

paid three times this month?

well. maybe i will. i get paid every other friday, and since this month has five fridays....

here's how to determine all the other months with five fridays for the next 20years, (ba)shilifically:

#!/bin/sh
year=2010
month=1
x=1

while [ $x -le 20 ]
do
  until [ $month -gt 12 ]
  do
    cal=`cal $month $year | grep ^31`
    if [ -z "$cal" ]
    then
      echo -n ""
    else
      echo
      cal $month $year
    fi
    month=`expr $month + 1`
  done
  month=1
  year=`expr $year + 1`
  x=$(( $x + 1 ))
done
Post a Comment