On 2010-01-05 00:40 (+0530), Foss User wrote:

> But when I don't enter input on the console by keyboard, but pipe it
> into the standard input of read, I am unable to store the input into
> the variable.
>
> $ echo bar | read a
> $ echo $a
> foo

Because of piping command "read a" is executed in another process so the
variable "a" has different binding there. It won't affect its mother
process in which you later executed the "echo $a" command. Here's
another example:

    $ a=foo
    $ echo bar | { read a; echo $a; }
    bar
    $ echo $a
    foo


-- 
Feel free to Cc me your replies
if you want to make sure I'll notice them.


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to