X-Git-Url: https://feistymeow.org/gitweb/?a=blobdiff_plain;f=scripts%2Fschedule%2Fcal.sh;h=3f380f52c24f34b2208f0ee76b7a3866b3b4d5e3;hb=a100971715d2cfa8f0496c92d4cad934ab7aed6c;hp=0d22282efd57e9b714825ba33938157f6786dfa5;hpb=2c7d26fba8f61ce3e9896f1dc6b6cdcab0061a32;p=feisty_meow.git diff --git a/scripts/schedule/cal.sh b/scripts/schedule/cal.sh index 0d22282e..3f380f52 100644 --- a/scripts/schedule/cal.sh +++ b/scripts/schedule/cal.sh @@ -1,12 +1,19 @@ #!/bin/bash # cal: a nicer interface to the unix cal program. +function our_date() +{ + date '+%A %B %d %Y' +} + case $# in - 0) set $(date); m=$2; y=$6 ;; # no arguments; use today - 1) m=$1; set $(date); y=$6 ;; # 1 argument; use this year + 0) set $(our_date); m=$2; y=$4 ;; # no arguments; use today + 1) m=$1; set $(our_date); y=$4 ;; # 1 argument; use this year *) m=$1; y=$2 ;; # 2 arguments; month and year esac +echo would run, after first case: "/usr/bin/cal $m $y" + case $m in jan*|Jan*|JAN*) m=1 ;; feb*|Feb*|FEB*) m=2 ;; @@ -20,8 +27,9 @@ case $m in oct*|Oct*|OCT*) m=10 ;; nov*|Nov*|NOV*) m=11 ;; dec*|Dec*|DEC*) m=12 ;; -[1-9]|10|11|12) ;; # numeric month -*) y=$m; m="" ;; # just a year + [1-9]|10|11|12) ;; # numeric month + *) y=$m; m="" ;; # just a year esac +echo running: "/usr/bin/cal $m $y" /usr/bin/cal $m $y # run the real one