#!/bin/bash outputfile=gallery.html photodescriptions=descriptions.txt overlaysdir="overlays" cat > $outputfile < gallery thing EOF for i in *png;do #for i in *jpg;do class=thumbnail w=$(identify -format %w $i); h=$(identify -format %h $i); if [ $h -gt $w ];then class="${class} portrait"; fi minusextension=$(echo ${i} | rev | cut -d . -f 2 | rev) title=$(grep ^${minusextension}: $photodescriptions | cut -d : -f 2); if [ -z "$title" ];then title=${i}; fi echo "\"${title}\"" >> $outputfile done cat >> $outputfile < EOF