#!/bin/bash
# export http_proxy=http://wr-linux01.rki.ivbb.bund.de:3128/
source /etc/local/profile.local > /dev/null

touch ~/tmp/pl-links.new
touch ~/tmp/pl-links.old
[ -s ~/tmp/pl-links.old ] && cp -a ~/tmp/pl-links.old ~/tmp/pl-links.old2
[ -s ~/tmp/pl-links.new ] && mv ~/tmp/pl-links.new ~/tmp/pl-links.old

lynx -dump http://www.pro-linux.de/ | \
     grep  www.pro-linux.de/news/[0-9]*/ | \
     cut -c 7- | sort | uniq >  ~/tmp/pl-links.new

# echo start1

cat ~/tmp/pl-links.new ~/tmp/pl-links.old ~/tmp/pl-links.old ~/tmp/pl-links.old2 ~/tmp/pl-links.old ~/tmp/pl-links.old2 |sort|uniq -u|while read a
do
	#echo $a
	w3m -dump_source "$a"| ~/bin/prolinux.pl > /tmp/pl_$$.html
	#echo 1
	w3m -dump /tmp/pl_$$.html > /tmp/pl_$$_.html
	#echo 2
	(echo $a; echo ; cat /tmp/pl_$$_.html)| mailx -a "Content-Type: TEXT/PLAIN; charset=UTF-8; format=flowed" -s "PL: `head -1 /tmp/pl_$$_.html`" tillea@localhost
	#echo 3
	rm /tmp/pl_$$.html /tmp/pl_$$_.html
	#echo 4
done
