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: http://www.nabble.com/Problem-with-reading-file-and-executing-other-stuffs--tf4733602.html#a13553050 Sent from the Gnu - Bash mailing list archive at Nabble.com.