[SunHELP] help with script

Gavin Winter sunhelp at sunhelp.org
Fri Nov 2 02:08:27 CST 2001


Hello all,
	I have a problem with the following script under Solaris 8 on Sparc: I am
trying to count the lines in a file but the output of 'linecount' is always
'0'. When I run the script with the -x option I can see linecount being
incremented. Is this a scope problem. Can someone give me some advice here?

regards

Gavin Winter



#!/bin/sh

linecount=0

for FILE in `ls test.*.txt`
do
	while read xx
 	do
		linecount=`expr $linecount + 1`
	done < $FILE
  	echo $linecount
done




More information about the SunHELP mailing list