Publish the Daily Garfield on Facebook shell script

For years now, I’m posting the daily Garfield and Dilbert comic on my Facebook page.

This is the (clumsy) script that does that:

wget -O page.html -erobots=off ${URLBASE}/
IMGURL=`grep "" page.html | awk -F'"' '{print $8}' | head -1`
wget -O garfield.gif ${IMGURL}
./ garfield.gif your-mobile-FB-emailaddress "Daily Garfield"
rm -rf page.html && rm -rf garfield.gif

Since I don’t want to use Mutt or sendmail, I’m using perl and Mail::Sender:

#!/usr/bin/perl -w
# Usage: ./ attachment to-address subject
my $file = $ARGV[0];
my $tolist = $ARGV[1];
my $subject = $ARGV[2];
my $datum= `date "+%d-%m-%Y"`; # optional
use Mail::Sender;
$sender = new Mail::Sender;if ($sender->MailFile({ 
smtp => 'localhost', 
from => '', 
to => "$tolist", 
subject => "$subject - $datum", 
msg => " ", 
file => "$file", 
}) < 0) { 
die "$Mail::Sender::Error\n"; 
print "Mail sent OK.\n";

As always, YMMV.

One thought on “Publish the Daily Garfield on Facebook shell script

Leave a Reply

Your email address will not be published. Required fields are marked *