#!/bin/sh ## ## SCRIPT: 00_GEN_tileTableCells4SMALLtileFiles.sh ## ## Started: 2010mar11 ## Changed: 2010 ## ## FOR TESTING: # set -v CELLSperROW=3 ## ## Initialize the htm output filename. ## HTMFILE="00_temp_tileTableCells_4SMALLtileFiles.htm" if test -f "$HTMFILE" then rm "$HTMFILE" fi ## 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 from image files in the ## "current working directory", where this script is. ## FILENAMES=`ls | egrep '\.jpg$|\.png$|\.gif$'` ## FOR TESTING: # echo "$FILENAMES" > "$HTMFILE" # exit ## ## START THE LOOP on the filenames, to build the ## rows of table-cells containing a tile image ## and a link to an HTML page to show the tile ## in use. ## 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. 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 "$FILENAMECROP" | sed 's|\.png$||'` FILENAMECROP=`echo "$FILENAMECROP" | 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}

tiled webpage
 
 
" >> "$HTMFILE" ## Show the tiles-in-rows page in a text editor ## and with a web browser. # kwrite "$HTMFILE" gedit "$HTMFILE" # firefox "$HTMFILE" seamonkey "$HTMFILE"