#!/bin/bash # Shift lines from the current presentation tabel to the past overview # Works with a crontab entry which is invoked on the fourth Tuesday of any given # months assuming that it's not December :-) # DIR=~jens/git/hugo date >$DIR/dat.txt # Check if invoked on a Wednesday if [[ $(date +%w) -eq 2 ]] ; then VOR=$DIR/vor.md PAST=$DIR/past.md # Are we in December (one line of entries left)? if [ $(wc -l <$VOR) -gt 1 ] ; then DA=$(date +%d.%-m.%Y) # Insert date for past presentations if omitted in the template # Do this for multiple lines A=$(head -1 $VOR | python3 /usr/local/bin/modDate.py | fgrep $DA) if [[ -n $A ]] ; then cp $PAST $PAST.org cp $VOR $VOR.org echo -e "$A\n$(cat $PAST)" >$PAST tail -n +2 $VOR >$VOR.0 mv $VOR.0 $VOR fi fi fi