I wrote a shell script to be a CGI script.
It takes all the pix in a specified directory, then output an HTML file
with each pictrue in "img" tags.
set $(ls -1 $wwwdir/$pixdir)
where wwwdir is the website's root dir and pixdir is the directory the
pix are in.
That makes variables 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11...
one for each filename.
In the loop where it outputs IMG tags, it increments the variable number
it then gets the current filename by:
it tells when it's at the end by using
if [ $curr != "" ]
it works fine with 1-8 pix
but 9 and up is bad
can you see the problem?
here it is:
With only 8, when it tries 9, that is empty because there is no such
But say theres 15. When it gets to 16 it basically takes the 1 and
interprets that as a variable and appends a 6.
How can I trap this, because it currently runs and endless loop and
hitting my server over and over with requests for nonexistant pix.