#!/bin/bash if [ -z "$1" -o ! -d "$1" ]; then echo "Usage: $0 []" 1>&2 exit 1 fi top="${1}" shift source "${top}/etc/settings.sh" tmp="$(mktemp -d)" cd "${tmp}" LC_ALL=C browser="Mozilla/4.06 [en] (X11; I; Linux 2.0.35 i586)" newn="${day}.jpg" echo "debug: daysago=$daysago, i.e. day=$(date -d "$daysago days ago" +%m)" echo "debug: grep for /geekandpoke/`date -d "$daysago days ago" +%Y`/$(echo $[$(date -d "$daysago days ago" +%m)])/$(echo $[$(date -d "$daysago days ago" +%d)])/[^\"]+" posturl=$(wget -q -O - "http://geek-and-poke.com/" | grep -oE "/geekandpoke/`date -d "$daysago days ago" +%Y`/$(echo $[$(date -d "$daysago days ago" +%m)])/$(echo $[$(date -d "$daysago days ago" +%d)])/[^\"]+" | head -n 1) echo "posturl: $posturl" if [ -n "$posturl" ]; then URL=$(wget -O - "http://geek-and-poke.com/$posturl" | sed -nre 's#.+