#!/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 DIR=. #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 3 ] ; then # Get third line from vor.md A=$(head -3 $VOR | tail -1) cp $PAST $PAST.org cp $VOR $VOR.org sed -i "3i$A" past.md sed -i '3d' vor.md fi #fi