#!/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}" date="$(date -d "$daysago days ago" +"%a, %d %b %Y")" newn="${day}.jpg" # get post link rss="http://www.timesfreepress.com/rss/headlines/opinion/cartoons/" rss_regex="${date}[^<]*[^<]*" url_regex=".*\([^<]*\).*" post=$(wget ${wget_args} -O - "${rss}" | grep "${rss_regex}" | sed "s#${url_regex}#\1#") if [ -n "${post}" ]; then # get img url from post img=$(wget ${wget_args} -O - "${post}" | grep '
' -A 3 | \ sed -n 's#.*