#!/bin/bash 

set -e
mail=$1
course=$2     

current="/tmp/$(echo $course | md5sum | cut -d' ' -f1)"
previous="/tmp/$(echo $course | md5sum | cut -d' ' -f1).old"

touch $current $previous

echo $current 

curl -sL $course | grep -v "DTSTAMP\|UID\|CREATED\|LAST-MODIFIED" > $current

if cmp -s "$current" "$previous" ; then
   echo "Tes niet."
else
   echo "Zemmen a liggen!"
   diff $current $previous | mailx  $mail -s "Lessenrooster Wijziging" 
fi

mv $current $previous