#!/bin/bash PRIJEMCI="nekdo@nekde.cz kdosi@kdesi.cz" ODESILATEL="dilbert@daily.cz" IMGDIR=$HOME/.dilbert DNES=`date "+%Y-%m-%d"` ID=$$ mkdir -p $IMGDIR &>/dev/null cd $IMGDIR wget --quiet --output-document=dilbert-$DNES.jpg \ `curl -s http://ekonomika.idnes.cz/dilbert.asp | egrep -i \ "i\.idnes\.cz.*\/maxi\/.*dilb.*" | grep -o "src=\"[^\"]*\"" | sed "s/src=\"//;s/\"//"` if [ -f dilbert-$DNES.jpg ] then diff dilbert-$DNES.jpg dilbert-latest.jpg &>/dev/null if [ $? -eq 2 ] then mpack -s "Dilbert $DNES" -c "image/jpg" dilbert-$DNES.jpg -o dilbert-$DNES.$ID cp dilbert-$DNES.jpg dilbert-latest.jpg for foo in $PRIJEMCI do echo "From: $ODESILATEL" > mail.$ID.$foo echo "To: $foo" >> mail.$ID.$foo echo "Precedence: bulk" >> mail.$ID.$foo cat dilbert-$DNES.$ID >> mail.$ID.$foo cat mail.$ID.$foo | /usr/sbin/sendmail -t -oi -f $ODESILATEL rm mail.$ID.$foo done rm dilbert-$DNES.$ID fi fi