#!/bin/sh ## ## SCRIPT: forLoop_displayImgsInFile.sh ## ## PURPOSE: For a given ## 1) image-viewer command string (program and some arguments) ## and ## 2) a text-file name (in which the file contains the ## fully-qualified names of image files). ## this script uses a 'for' loop to show each of the ## image files via the image-viewer command string. ## ## It is assumed that the image-viewer works such that ## when the user closes the image-viewer window, the ## next image is shown. ## ## CALLED BY: a 'wrapper' Tk script: ## find_and_imageViewer_FrontEnd.tk. ## ##+####################################################################### ## Created: 2013dec12 For use in a calling shell script: ## getImages_andCountPrintOrView.sh ## which in turn, is called by a 'wrapper' Tk script: ## find_and_imageViewer_FrontEnd.tk. ## Changed: 2014apr25 Add TOTALfiles and CNT variables, and add ## an 'echo' of those numbers to stdout. ##+####################################################################### ## FOR TESTING: (show statements as they execute) # set -x ##+########################################################## ## Put the 2 arguments into variables with descriptive names. ##+########################################################## IMGVIEWER="$1" TEMPFILE="$2" ##+########################################################## ## Get the number of files in file $2. ##+########################################################## TOTALfiles=`cat "$TEMPFILE" | wc -l` ##+########################################################## ## Initialize an image count variable. ##+########################################################## CNT=1 ##+###################################################### ## Use the image-viewer program (and any parms that are to ## be used with it) to show each of the image files whose ## names are in $TEMPFILE. ##+###################################################### for FILENAME in `cat "$TEMPFILE"` do echo "Showing $CNT of $TOTALfiles." $IMGVIEWER "$FILENAME" 2> /dev/null CNT=`expr $CNT + 1` done