#!/bin/bash
tag="http://www.linuxbyte.net/ShowArt.php3?ID="
indexurl="http://www.linuxbyte.net/articles.php"
function postpage()
{
echo "#name: xxx"
echo "#password: xxx"
echo "#board: Linux"
echo "#title: $title"
echo ""
cat page
}
function getpage()
#input valid URLs
{
while [ 1 ]
do
read url
if [ $? -ne "0" ]; then
break
fi
old=`grep $url urls_linux` #检查文章是否已经存在
echo $url >> urls_linux #把url添加到记录中
if [ "$old" = "" ]; then
echo downloading news page...
lynx -source $url > page.htm #读取网页内容
lynx -dump -nolist page.htm | ./body_linux > page
title=`head -2 page | tail -1`
echo posting $title
fi
done
}
echo downloading index file...
lynx -dump $indexurl | grep $tag | cut -c 7- | getpage
rm -f page.htm
rm -f page
cd ~
exit 0
放在crontab里面执行就可以了
--
FROM 202.119.144.5