bug-bash
[Top][All Lists]
Advanced

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

Re: while read subcommand problem


From: Richard van der Leeden
Subject: Re: while read subcommand problem
Date: Fri, 2 Mar 2007 08:53:24 -0800 (PST)



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.





reply via email to

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