Mark Allums wrote:
On 1/4/2010 1:10 PM, Foss User wrote:
I see that the read command stores input entered only on the console
into the variables. Example:
$ read a
foo
$ echo $a
foo
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
As others pointed out, the variable a that is read is in another shell.
If you want to do something like this, you need to turn it around:
a=$(echo bar)
Eric
--
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org