Re: while read subcommand problem

2007-03-02 Thread Richard van der Leeden



Paul Jarc wrote:
 
 
 Can you explain what was unsatisfactory about the alternatives given
 in the FAQ, so we have a better idea of what would be acceptable?
 
 Here's one possibility:
 ... | { while ...; do var=...; done; use $var; }
 
 

Thanks for the reply, and a possible solution.

The examples in the FAQ do work for the their examples, but I can't figure
out a clean way to implement it with a while loop when reading in lines from
the output of a piped command(s).

Your solution also works, but would be very messy if I wanted to use $var
much later in the script as I would need the rest of the script kept in the
{ }.

I suppose, after years of using the ksh I'm missing the (in my opinion) the
clearer 'command | while read' solution.
-- 
View this message in context: 
http://www.nabble.com/while-read-subcommand-problem-tf3332952.html#a9273080
Sent from the Gnu - Bash mailing list archive at Nabble.com.



___
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash


Re: while read subcommand problem

2007-03-02 Thread Richard van der Leeden

Thank you Paul, Andreas and Kevin.

Both the here document solution and the Process substitution solution both
work well. I haven't had a good look to see the subtle differences between
the two yet.

Thank you again.
-- 
View this message in context: 
http://www.nabble.com/while-read-subcommand-problem-tf3332952.html#a9274702
Sent from the Gnu - Bash mailing list archive at Nabble.com.



___
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash