//View Tip #878
Similar Tips
» Command examples from shell-fu
» Calendar with today colored [handle single digit dates]
» Stream YouTube videos directly to your media player
» Remove comments and blank lines
» Random IP addresses

 

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 »



Comments 

Add your comment

Comments are currently disabled
tom
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

tom
Posted 2009-09-14 09:54:18
syssyphus
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