#!/bin/zsh files=(sony/DSC?????.jpg htc/IMG_*_??????.jpg) len=${#files[@]}; touch all.tmp for i in `seq 1 $len `; do touch tmp if [ $i -ne 1 ]; then prev=$files[$(($i - 1))]; bn_prev=${prev/.jpg/} printf "prev\n" $bn_prev >> tmp fi printf "all\n" >> tmp if [ $i -ne $len ]; then next=$files[(($i + 1))]; bn_next=${next/.jpg/} printf "next\n" $bn_next >> tmp fi printf " %s/%s\n" $i $len >> tmp this=$files[$i]; bn_this=${this/.jpg/} printf "\n" $bn_this.html $bn_this >> all.tmp printf "
" >> tmp printf "\n" $this $bn_this >> tmp if [ -f $bn_this.desc ]; then printf "
\n" >> tmp cat $bn_this.desc >> tmp fi rg="s/13371337/`basename $bn_this`/g" (cat tmpl_h.html tmp; sed -e $rg tmpl_f.html) > $bn_this.html rm tmp done printf "

download: hi-res, lo-res\n" >> all.tmp (cat tmpl_h.html all.tmp; sed -e s/13371337/dreadcutmain/g tmpl_f.html) > index.html rm all.tmp