bug-bash
[Top][All Lists]
Advanced

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

Re: Problem with reading file and executing other stuffs?


From: Hugh Sasse
Subject: Re: Problem with reading file and executing other stuffs?
Date: Fri, 2 Nov 2007 18:37:27 +0000 (WET)

On Fri, 2 Nov 2007, Horinius wrote:

> 
> 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 )

The while loop should never be very big.  Functions and loops should
be kept short for ease of debugging/maintenance.   There are other
tools for doing this kind of work, whose syntax you may prefer...

> 
> 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?

Already answered by Paul.
> 
> 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.

This is a Unix convention.  I don't know the origins.

I've looked at the context of this message, I missed the first one, 
and you say that counting lines is not the problem (of course, you have
wc for that).  What are your goals here?  Depending on that there may be
other ways to tackle the problem.  Clearly if your goal is to learn about
using read in while loops in bash, other tools won't help.

        Hugh




reply via email to

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