From fa65fc4f8dfb8c61c5ddeec8d3607166b350a408 Mon Sep 17 00:00:00 2001 From: Chris Koeritz Date: Wed, 21 Apr 2021 17:41:49 -0400 Subject: [PATCH] fixed to use specific date format old version counted on some antiquated ordering of fields from date command, but now we force the issue by providing a format. --- scripts/schedule/cal.sh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) 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 -- 2.34.1