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

bash/read built-in function



can someone shed some light on this, please?
(indented to facilitate reading)

bash-2.05$ bash --version
  GNU bash, version 2.05.0(1)-release (i386-pc-linux-gnu)
  Copyright 2000 Free Software Foundation, Inc.
bash-2.05$ dpkg -l bash | grep bash
  ii  bash           2.05-10        The GNU Bourne Again SHell
bash-2.05$ read a b
  hello, world, this is a test
bash-2.05$ echo $b
  world, this is a test
bash-2.05$ echo "hello, world, this is ANOTHER test" | read a b
bash-2.05$ echo $b
  world, this is a test
bash-2.05$ export b
bash-2.05$ echo "hello, world, this is ANOTHER test" | read a b
bash-2.05$ echo $b
  world, this is a test

is this because the pipe really just spawns another shell and thus the
variable $b of the spawning shell is preserved? or is this a bug?

-- 
martin;              (greetings from the heart of the sun.)
  \____ echo mailto: !#^."<*>"|tr "<*> mailto:"; net@madduck
  
"time flies like an arrow. fruit flies like a banana."
                                                       -- groucho marx

Attachment: pgpRV9RzdjRj0.pgp
Description: PGP signature


Reply to: