bug-bash
[Top][All Lists]
Advanced

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

Re: echo thing | read thang


From: Philip Lijnzaad
Subject: Re: echo thing | read thang
Date: 02 Aug 2001 00:23:39 +0100

On Wed, 01 Aug 2001 18:36:09 -0400, 
"Paul" == Paul Jarc <address@hidden> wrote:



Paul> 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).

Paul> See question E4 in the FAQ; 

apologies, didn't have that handy ... 

Paul> each command in a pipeline is run in a
Paul> separate process, so the process that performs the "read" commands is
Paul> not the process that performs the subsequent "echo" command.  

I see, that makes sense (unfortunately ... would be nicer if this restriction
weren't there) But the variable the things are read 'in to' are 'seen' by the
parent shell. At least, that's the way it appears to be with the if and while
constructs.

Paul> You may find this useful: read var < <(command)

Thanks for telling me about this construct (I can't say it looks very
intuitive or elegant, though). Thanks,

                                                                      Philip

-- 
Real programs don't eat cache (Malay)
-----------------------------------------------------------------------------
Philip Lijnzaad, address@hidden \ European Bioinformatics Institute,rm A2-08
+44 (0)1223 49 4639                 / Wellcome Trust Genome Campus, Hinxton
+44 (0)1223 49 4468 (fax)           \ Cambridgeshire CB10 1SD,  GREAT BRITAIN




reply via email to

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