[Top][All Lists]

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

Re: Problem with reading file and executing other stuffs?

From: Horinius
Subject: Re: Problem with reading file and executing other stuffs?
Date: Fri, 2 Nov 2007 11:06:14 -0700 (PDT)

Paul Jarc wrote:
> If you're reading from a regular file, you can just eliminate the
> useless use of cat:
> while read line; do ...; done < test.txt

Oh yes!  This is a lot better and syntactically simpler than using the file
descriptor 6 (which nevertheless is also a working solution).

It's a pity that the filename can't be put before the while loop or it'll be
a lot easier to read, esp when the while loop is very big.  (Once more, no
need to answer to this comment of mine :p )

Is there any pitfall using this solution of yours?  You talked about
"regular file", what's that supposed to be?  Text file vs binary file?

I've found that if the last line isn't terminated by a new-line, that line
can't be read.  This seems to be a very common error and I've seen it in
other commands.

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]