yearistype.sh revision 158417
1#! /bin/sh 2 3: '@(#)yearistype.sh 8.1' 4 5case $#-$1 in 6 2-|2-0*|2-*[!0-9]*) 7 echo "$0: wild year - $1" >&2 8 exit 1 ;; 9esac 10 11case $#-$2 in 12 2-even) 13 case $1 in 14 *[24680]) exit 0 ;; 15 *) exit 1 ;; 16 esac ;; 17 2-nonpres|2-nonuspres) 18 case $1 in 19 *[02468][048]|*[13579][26]) exit 1 ;; 20 *) exit 0 ;; 21 esac ;; 22 2-odd) 23 case $1 in 24 *[13579]) exit 0 ;; 25 *) exit 1 ;; 26 esac ;; 27 2-uspres) 28 case $1 in 29 *[02468][048]|*[13579][26]) exit 0 ;; 30 *) exit 1 ;; 31 esac ;; 32 2-*) 33 echo "$0: wild type - $2" >&2 ;; 34esac 35 36echo "$0: usage is $0 year even|odd|uspres|nonpres|nonuspres" >&2 37exit 1 38