Hi,
I got the following codes in my shell script (using /bin/sh) :
#!/bin/sh
this_count=0;export this_count
while read ip other
do
if [ $PREV_IP != $ip ]
then
PREV_IP=$ip;export PREV_IP
printf "IP %s has visited\n" $ip
echo $this_count
this_count=`expr $this_count + 1`;export this_count
fi
done < $TEMP_FILE
echo value of count is $this_count
I expected that I could get the value of count "this_count" after loop
but actually, I only got "0" as the value, no matter how much iteration
the loop has performed.
Can anyone tell me what's happened to this shell script? How can I
retrieve values from the loop?
Thanks a lot.
--
Patrick