#!/bin/sh - # today - print near month calendars with the current date highlighted # William Bulley, web@umich.edu # restyled by Steve Kinzler, kinzler@cs.indiana.edu, Jun 08 # http://www.cs.indiana.edu/~kinzler/home.html#other so="`(tput so) 2> /dev/null`" # termcap test -z "$so" && so="`(tput smso) 2> /dev/null`" # terminfo test -z "$so" && so="`(tput rev) 2> /dev/null`" # terminfo alt test -z "$so" && so='' # assume ANSI se="`(tput se) 2> /dev/null`" test -z "$se" && se="`(tput rmso) 2> /dev/null`" test -z "$se" && se="`(tput sgr0) 2> /dev/null`" test -z "$se" && se='' set x `date +'%m %Y %d'`; shift if test "$#" -ne 3 then echo "$0: cannot determine current date" 1>&2; exit 1 fi d=`echo "$3" | sed 's/^0*//'` date echo '' if test "$1" -eq 1 then cal 12 `expr "$2" - 1` else cal `expr "$1" - 1` "$2" fi echo '' cal "$1" "$2" | sed "s/_//g; s/^$d /$so$d$se /; s/ $d$/ $so$d$se/; s/ $d / $so$d$se /; s/^$d$/$so$d$se/" echo '' if test "$1" -eq 12 then cal 1 `expr "$2" + 1` else cal `expr "$1" + 1` "$2" fi