#!/bin/bash # to produce an html page of a directory of images # filename to save as fn=00images.html # top of the html page echo ' ${fn} echo '"http://www.w3.org/TR/REC-html40/loose.dtd"' >> ${fn} echo '' >> ${fn} echo ' ' >> ${fn} echo ' ' >> ${fn} echo ' directory index' >> ${fn} echo ' ' >> ${fn} echo ' ' >> ${fn} echo ' ' >> ${fn} # main body of the html page, # check everything in current directory for n in * do # is it a file? if [ -f ${n} ] then echo -n ' ' >> ${fn} # is the file an image? if [ "$(file ${n} | grep -ci ' image data')" -ne "0" ] then echo -n '' >> ${fn} fi # end the tag, whether image or other file echo ${n}'
' >> ${fn} fi done # end the html page echo ' ' >> ${fn} echo '' >> ${fn}