summaryrefslogtreecommitdiffstats
path: root/shack/bin/is-plenum
diff options
context:
space:
mode:
Diffstat (limited to 'shack/bin/is-plenum')
-rwxr-xr-xshack/bin/is-plenum34
1 files changed, 34 insertions, 0 deletions
diff --git a/shack/bin/is-plenum b/shack/bin/is-plenum
new file mode 100755
index 00000000..1c686ca1
--- /dev/null
+++ b/shack/bin/is-plenum
@@ -0,0 +1,34 @@
+#! /bin/sh
+#
+# //shack/is-plenum [YEAR]
+#
+# where YEAR defaults to the current year
+#
+
+y=${1-`date +%Y`}
+for m in `seq 1 12`; do
+ t1=
+ t2=
+ t3=
+ t4=
+ t5=
+ week_done=-1
+ for d in `cal $m $y | tr ' ' '\n' | grep '^[0-9][0-9]\?$'`; do
+ echo $m | grep -q '^.$' && m=0$m
+ echo $d | grep -q '^.$' && d=0$d
+ date=$y-$m-$d
+ date_week=`date -d $date +%W`
+ if test $week_done -lt $date_week; then
+ test -z "$t1" && { test `date -d $date +%u` = 4 && t1=$date && week_done=$date_week; continue; }
+ test -z "$t2" && { test `date -d $date +%u` = 3 && t2=$date && week_done=$date_week; continue; }
+ test -z "$t3" && { test `date -d $date +%u` = 4 && t3=$date && week_done=$date_week; continue; }
+ test -z "$t4" && { test `date -d $date +%u` = 3 && t4=$date && week_done=$date_week; continue; }
+ test -z "$t5" && { test `date -d $date +%u` = 3 && t5=$date && week_done=$date_week; continue; }
+ fi
+ done
+ test -n "${t1}" && echo $t1
+ test -n "${t2}" && echo $t2
+ test -n "${t3}" && echo $t3
+ test -n "${t4}" && echo $t4
+ test -n "${t5}" && echo $t5
+done