On Tue, Nov 27, 2001 at 06:24:13PM -0500, Paul M Foster wrote:
> Here's what I've got: I want to be able to peel off one line at a time
> from a file and process just that line, before going on to the next one.
> I tried something like:
> 
> cat myfile | while read ; do
> 	do_something $REPLY
> done
> 
> but it didn't work. I'm trying to avoid awk, sed, perl and such, and
> only do this in bash.
> 
> Any clues?
> 
Apparently, this works:
cat myfile | (
while read ; do
        do_something $REPLY
done
)
I have tested this, but not extensively. I stole it from one of the Red
Hat init scripts (good place to examine working bash scripts). Why it
works, I do not know.
Paul
This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 18:54:30 EDT