summaryrefslogtreecommitdiffstats
path: root/shack
diff options
context:
space:
mode:
authortv <tv@xso>2011-09-03 20:15:27 +0200
committertv <tv@xso>2011-09-03 20:15:27 +0200
commit9aa3e3f24c18562e39168cdd629ed1019a4ac317 (patch)
treea2290109020065500071055bbd0c8cd12e82c693 /shack
parente82fe298c97010dedea03dc9f3c3de68fb3bd336 (diff)
shack is-plenum: initial commit
Diffstat (limited to 'shack')
-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