[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

Re: How does a pipe works?



Shridhar Daithankar wrote:

>  Now consider this
> >
> > $ read var_name  |  echo HELLO
> > HELLO
> > <here some i/p has to be fed by the user>
> > $echo $var_name     # I try to see what the variable has been read into
> > <blank line displayed>
> > $
> When you use pipe, output of leftside command is fed as input to right
> side command. So what you are doing in fedding output of 'read var'(which
> is none IIRC) is fed as input to 'echo HELLO' which does not require any
> output. Obviously var will not contain any value. Pipes are not electrical
> wires which can work both ways...(At low frequencies and/or if
> echo equalizers are not installed..)

Shridhar :  The o/p of left hand side is  connected as i/p to  RHS of pipe, is
understood. But why does not the LHS command gets executed & read the var
value from the standard i/p and srtore into the user defined variable?

--RK