//View Tip #878
Similar Tips
» Backup delicious bookmarks
» Convert permissions to octal
» Stream YouTube videos directly to your media player
» Find words in garbled text
» Crawl a web page for links


Latest tips by RSS
Click here to subscribe
Follow Shell-Fu on Twitter
Click here to follow
Follow Shell-Fu on identi.ca
Click here to follow
Displays a random xkcd comic. Requires ImageMagick.

wget http://dynamic.xkcd.com/comic/random/ -O -| grep <img src="http://imgs.xkcd.com/comics | 
 sed s/<img src="// | sed s/"[a-z]*.*// | wget -i - -O -| display

View Comments »


Add your comment

Comments are currently disabled
I need some changes, to get the code running on my system. I have to mask the '"' and one whitespace. The "-q" for wget are optional.

wget -q http://dynamic.xkcd.com/comic/random/ -O -| grep "<img src=\"http://imgs.xkcd.com/comics"; | sed s/\<img\ src=\"// | sed s/\"[a-z]*.*//| wget -q -i - -O -| display

Posted 2009-09-14 09:54:18
this one works:

wget -q http://dynamic.xkcd.com/comic/random/ -O - | grep -Eo http://imgs.xkcd.com/comics/.*png | wget -q -i - -O - | display
Posted 2009-09-14 11:36:43

Home Latest Browse Top 25 Random Hall Of Fame Contact Submit