[SunHELP] help with script

sunhelp at sunhelp.org sunhelp at sunhelp.org
Fri Nov 2 11:32:00 CST 2001


While this should be easy to fix, why not just use `wc -l'?

> 
> 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
> 
> _______________________________________________
> SunHELP maillist  -  SunHELP at sunhelp.org
> http://www.sunhelp.org/mailman/listinfo/sunhelp





More information about the SunHELP mailing list