#!/bin/sh ## ## SCRIPT: 00_GEN_imgTableCells4jpggiffiles.sh ## ## Started: 2009aug18 ## Last update: 2010jul20 ## ## FOR TESTING: # set -v CELLSperROW=6 ## ## Initialize the htm output file. ## HTMFILE="00_temp_imgTableCells_thumbsAndLinks.htm" rm "$HTMFILE" ## Put the top of the HTML code in the html file -- ## just enough code so that the page can be shown ## in a web browser with suitable formatting ## of the table cells. In particular, we need a ## statement. echo "
" > $HTMFILE ## ## Set the filenames list. ## # FILENAMES=`ls | grep '\.jpg$'` FILENAMES=`ls | egrep '\.jpg$|\.gif$'` ## FOR TESTING: # echo "$FILENAMES" > "$HTMFILE" # exit ## ## START THE LOOP on the filenames. ## FILECNT=0 ROWCNT=0 for FILENAME in $FILENAMES do FILECNT=`expr $FILECNT + 1` ROWID=" " ## IF AT START of ROW, set ROWCNT and ROWID and ## write start-of-row HTML indicators (row-number-comment and ). if test `expr $FILECNT % $CELLSperROW` = 1 then ROWCNT=`expr $ROWCNT + 1` ROWID="row $ROWCNT" echo " " >> $HTMFILE fi # FILENAMECROP=`echo "$FILENAME" | sed 's|\.jpg$||'` FILENAMECROP=`echo "$FILENAME" | sed 's|\.jpg$||'` | sed 's|\.gif$||'` ## Write out table cell definition. echo " " >> "$HTMFILE" ## IF AT END OF ROW, write out table-row-end indicator. if test `expr $FILECNT % $CELLSperROW` = 0 then echo " " >> "$HTMFILE" fi done ## ## END OF FILES LOOP. Write out bottom of htm file. ## if test `expr $FILECNT % $CELLSperROW` != 0 then while test `expr $FILECNT % $CELLSperROW` != 0 do echo " " >> "$HTMFILE" FILECNT=`expr $FILECNT + 1` done echo " " >> $HTMFILE fi echo "

$ROWID
 
 
" >> "$HTMFILE" # kwrite "$HTMFILE" gedit "$HTMFILE" & # firefox "$HTMFILE" seamonkey "$HTMFILE"