[Top][All Lists]

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

Re: echo thing | read thang

From: Chris F.A. Johnson
Subject: Re: echo thing | read thang
Date: Thu, 02 Aug 2001 03:22:32 GMT

On Wed, 1 Aug 2001, Paul Jarc wrote:

> Philip Lijnzaad <address@hidden> writes:
> > (I was actually exploring why on earth echo foo | read bar; echo $bar does
> > not work; I consider this a bug as well, perhaps not as 'blatant' as the
> > above one, but puzzling nonetheless).
> See question E4 in the FAQ; each command in a pipeline is run in a
> separate process, so the process that performs the "read" commands is
> not the process that performs the subsequent "echo" command.  You may
> find this useful: read var < <(command)


cmd1 | {
        while read var
            var1="$var $var1"
        echo $var1

All the commands within the braces are executed in the same subshell.

        Chris F.A. Johnson          address@hidden
        address@hidden      http://cfaj.freeshell.org
        address@hidden      http://members.home.net/c.f.a.johnson

reply via email to

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