Hi Dave,
Just so we're not working at cross purposes here, as evo2 effectively said here:
Quote:
Originally Posted by evo2
If this is bash you can use
Code:
((endofrowcount++))
|
something like
Code:
table_cell_count=$table_cell_count+1
does not actually increment the value of table_cell_count.
Since as has been pointed out by other folks, you had made some typing errors, I was hoping your use of the "+1" was just a different sort of mistake. I was hoping you are using bash, and are very familiar with bash.
If you are using bash, but are not familiar with it in detail, then please note the following.
What I did actually concatenates a '+1' onto the end of the existing
string value of the table_cell_count. I was cheating and taking advantage of a side effect of the later execution of $(( table_cell_count % 2 )) which evaluates a
string something like 0+1+1+1+1+1 in an arithmetic context.
I really had trouble trying to figure out exactly what you were trying to do. I guessed that maybe for some reason you were going in the direction of using $(()) later in your code, but just hadn't gotten there yet. I thought if what you were doing was just a "one off", just for a single use, not something that would be processing a lot of data on an ongoing basis, it wasn't too bad.
In general, what evo2 showed you
((endofrowcount++)) should be used because it's more efficient.