Weblog entry #43 for Utumno
We sometimes forget that those shiny graphical apps like firefox can be controlled from the commandline, too!
For example, here's a way to automatically open up all articles that are currently on this site's main page, each one in its own tab:
#!/bin/sh TMPFILE=`mktemp` URL="http://www.debian-administration.org"; wget -q $URL -O - | sed -n "s#.*<h2 class=\"title\"><a href=\"\(\/articles.*\)\".*#$URL\1#p" > $TMPFILE I=0 while read line do firefox -new-tab $line & if [ $I -eq 0 ]; then sleep 5 let "I+=1" fi done < $TMPFILE rm -f $TMPFILE
( after opening up the first article we better sleep for 5 seconds, otherwise we end up with many firefoxes)
Comments on this Entry
[ Parent | Reply to this comment ]
[ Send Message | View Utumno's Scratchpad | View Weblogs ]
Because I dont know how to pipe multiline input to the loop...
[ Parent | Reply to this comment ]