Ultimate One-Liner

By Phil Matarese on April 18th, 2008

Tagged with: dilbert, one-liner

Update - This post has fallen flat, now that you can subscribe to daily dilberts for free.

I love one-liners, and here's the command I use to read Dilbert everyday:

curl -s http://dilbert.com | grep -o -m1 -E '\/comics\/dilbert\/archive\/images\/dilbert[0-9]*\.(gif|jpg|jpeg)' | sed "s/\(.*\)/--url http:\/\/dilbert.com\1/" | curl -s --config - | open -f -a Preview.app

From now on, I expect you to finish all of your projects in one hour.Unlike other publications, I don't read dilbert.com for the articles.  I also don't read it for the advertisements or any of the other junk – I just want to see today's comic.  Only, the file for the daily comic has randomness in the filename which makes it complicated to automatically scrape the comic (I guess they want to avoid people doing what I'm doing... silly people).  Nothing is too complicated for a one-liner, though.

I aliased this script in my .bash_login file, so a fresh Dilbert is always just a few keystrokes away.  (Sorry, the Preview.app part makes it only work on Mac.  I guess you'd have to pipe it into a different app for other systems.)

Comments

Weigh in

(HTML tags are stripped, URLs are automatically converted to links)