home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume4 / settz / years.sh < prev   
Encoding:
Text File  |  1986-11-30  |  382 b   |  30 lines

  1. : '@(#)years.sh    2.1'
  2.  
  3. : years lo hi type
  4.  
  5. case $# in
  6.     3)        ;;
  7.     *)        echo "$0: usage is $0 lo hi type" 1>&2
  8.             exit 1 ;;
  9. esac
  10.  
  11. lo="$1"
  12. hi="$2"
  13. type="$3"
  14.  
  15. case $type in
  16.     uspres)        check='(y % 4) == 0' ;;
  17.     nonpres)    check='(y % 4) != 0' ;;    
  18.     *)        echo "$0: wild year type ($type)" 1>&2
  19.             exit 1 ;;
  20. esac
  21.  
  22. exec awk "
  23. BEGIN {
  24.     for (y = $lo; y <= $hi; ++y)
  25.         if ($check)
  26.             print y;
  27.     exit
  28. }
  29. "
  30.