0d22282efd57e9b714825ba33938157f6786dfa5
[feisty_meow.git] / scripts / schedule / cal.sh
1 #!/bin/bash
2 # cal: a nicer interface to the unix cal program.
3
4 case $# in
5         0)      set $(date); m=$2; y=$6 ;;      # no arguments; use today
6         1)      m=$1; set $(date); y=$6 ;;      # 1 argument; use this year
7         *)      m=$1; y=$2 ;;                   # 2 arguments; month and year
8 esac
9
10 case $m in
11         jan*|Jan*|JAN*) m=1 ;;
12         feb*|Feb*|FEB*) m=2 ;;
13         mar*|Mar*|MAR*) m=3 ;;
14         apr*|Apr*|APR*) m=4 ;;
15         may*|May*|MAY*) m=5 ;;
16         jun*|Jun*|JUN*) m=6 ;;
17         jul*|Jul*|JUL*) m=7 ;;
18         aug*|Aug*|AUG*) m=8 ;;
19         sep*|Sep*|SEP*) m=9 ;;
20         oct*|Oct*|OCT*) m=10 ;;
21         nov*|Nov*|NOV*) m=11 ;;
22         dec*|Dec*|DEC*) m=12 ;;
23 [1-9]|10|11|12) ;;                              # numeric month
24 *)                      y=$m; m="" ;;           # just a year
25 esac
26
27 /usr/bin/cal $m $y                              # run the real one