#!/bin/ksh # $Id: got,v 1.8+2 2008/08/31 01:30:00 vogelke Exp $ # got: Look through Mozilla download record for where I got things. PATH=/usr/local/bin:/usr/sfw/bin:/opt/sfw/bin:/bin:/usr/bin export PATH tag=`basename $0` # Bail if we're not looking for anything case "$#" in 0) echo need a pattern; exit 0 ;; *) ;; esac # Can't read the database if Firefox is running, so copy it. test -f $HOME/.envrc.sh && . $HOME/.envrc.sh dbfile="/tmp/$tag.db.$$" results="/tmp/$tag.res.$$" case "$MOZILLA_HISTORY" in "") echo "MOZILLA_HISTORY not set"; exit 1 ;; *) cp $MOZILLA_HISTORY $dbfile ;; esac cat << EndSQL | sqlite $dbfile > $results SELECT moz_historyvisits.visit_date, moz_places.url FROM moz_places, moz_historyvisits WHERE moz_places.id = moz_historyvisits.place_id; EndSQL for pattern in $* do echo echo '===========' $pattern grep -i "$pattern" $results | cut -f2 -d'|' | sort -u done rm $dbfile $results exit 0