Get the latest Dilbert Cartoon (Rated 5)Description:
Grab the latest Dilbert Cartoon :)
Essential for a day at work ;) Code starts here
#!/bin/sh
export http_proxy=http://localhost:80/
dilberthome=$HOME/library/700/790/humour/dilbert
public=/usr/local/etc/httpd/htdocs/
cd /tmp
rm index.html
set `date '+%d %m %y'`
day=$1
month=$2
year=$3
# first get the main page -- this gives us the URL for the picture
if lynx -source http://www.unitedmedia.com/comics/dilbert/index.html > index.html
then
:
else
exit 1
fi
# look for something like dilbert98081090304.gif
picture=`egrep 'dilbert[0-9]*\.gif|dilbert[0-9]*\.[jg][ip][fg]' index.html | head -1 | sed 's/.*\(dilbert[0-9]*\.[jg][ip][gf]\).*/\1/'`
if lynx -dump http://www.unitedmedia.com/comics/dilbert/archive/images/$picture > $picture
then
cp $picture $public/dailydilbert
chmod 644 $public/dailydilbert
echo y | mv $picture $dilberthome
ln -s -f $dilberthome/$picture $HOME/dailydilbert
ln -s -f $dilberthome/$picture $dilberthome/`todaysdate`
exit 0
else
exit 2
fi
exit 0
Submitted by Devscripts on 27-02-2003 20:51 |