Hello all,
In a Bourne shell script on Solaris 8 I am attempting to use the expr command to implement a counter in my script. The problem is my COUNTER variable seems to lose it's value after the loop. While in the loop the COUNTER works as it echos out incrementing values properly.
Here is my script snippet:
What can you recommend?
Thanks,
Michael42
In a Bourne shell script on Solaris 8 I am attempting to use the expr command to implement a counter in my script. The problem is my COUNTER variable seems to lose it's value after the loop. While in the loop the COUNTER works as it echos out incrementing values properly.
Here is my script snippet:
Code:
COUNTER=0
while read LINE
do
echo Processing: $LINE
[COLOR=green]# The below line displays the correct value[/color]
COUNTER=`expr $COUNTER + 1`
echo $COUNTER
done < /tmp/items.lst
[COLOR=green]# The below line displays [b]0[/b] ????!!![/color]
echo $COUNTER
What can you recommend?
Thanks,
Michael42