Re: Problem with reading file and executing other stuffs?
From:
Paul Jarc
Subject:
Re: Problem with reading file and executing other stuffs?
Date:
Fri, 02 Nov 2007 14:13:41 -0400
User-agent:
Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux)
Horinius <lapsap7+nabble@gmail.com> wrote:
> 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?
No, just that it doesn't work for pipes, so the data you're reading
has to be in a named file, not produced as the output of another
program. But even in that case, you could do it like this:
while read line; do ...; done <<EOT
$(data-producer-command)
EOT
That will also ensure that the last line ends with a newline, but the
$() command substitution will also remove any trailing empty lines,
which might be a problem, depending on what you're doing.
paul