[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problem with reading file and executing other stuffs?

From: Horinius
Subject: Problem with reading file and executing other stuffs?
Date: Thu, 1 Nov 2007 12:32:07 -0700 (PDT)

I've been struggling with the following code of reading a text file
(test.txt) and counting the number of lines.  Well, I know there're simpler
method to count the number of lines of a text file, but that's not the point
of this post.

cat test.txt | 
while read line
        echo "${line}"

echo "$n"

The result of the last echo is zero, meaning that n is never incremented
inside the while loop.  It seems to me that inside this while loop, except
the echo of the lines, nothing else is done.

Pitfall? Bug?  Or feature?

I'd appreciate if somebody could shed some light on this.

View this message in context: 
Sent from the Gnu - Bash mailing list archive at Nabble.com.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]