[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
assigning variables at the end of a pipeline
From: |
Elmar Stellnberger |
Subject: |
assigning variables at the end of a pipeline |
Date: |
Fri, 26 Jan 2007 17:32:43 +0100 |
User-agent: |
Thunderbird 1.5.0.9 (X11/20060911) |
From: estellnb@lycos.at
To: bug-bash@gnu.org
Subject: assigning variables at the end of a pipeline
Message-Id: <20070126161828.7E3C8141E6@sonic.site>
Date: Fri, 26 Jan 2007 17:18:28 +0100 (CET)
Configuration Information [Automatically generated, do not change]:
Machine: i586
OS: linux
Compiler: gcc -I/usr/src/packages/BUILD/bash-3.1
-L/usr/src/packages/BUILD/bash-3.1/../readline-5.1
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i586'
-DCONF_OSTYPE='linux' -DCONF_MACHTYPE='i586-suse-linux'
-DCONF_VENDOR='suse' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash'
-DSHELL -DHAVE_CONFIG_H -I. -I. -I./include -I./lib -O2 -march=i586
-mtune=i686 -fmessage-length=0 -Wall -D_FORTIFY_SOURCE=2 -g
-D_GNU_SOURCE -DRECYCLES_PIDS -Wall -pipe -g -fbranch-probabilities
uname output: Linux sonic 2.6.18.2-34-default #1 SMP Mon Nov 27 11:46:27
UTC 2006 i686 i686 i386 GNU/Linux
Machine Type: i586-suse-linux
Bash Version: 3.1
Patch Level: 17
Release Status: release
estellnb:~> echo xx | while read hug; do echo $hug; done
xx
> echo $hug
sadasd
estellnb:~> echo xx | read hug; echo $hug
sadasd
'hug' is supposed to be valid outside the loop as well!
Why is there an own fork of bash for the last process in the pipeline
(i.e. "while read hug; do echo $hug; done" or "read hug" respectively) ??
hug=$(
..
..
..
)
can easily become somewhat unhandy
Moreover we possibly want to assign to multiple variables when reading
from a file
- assigning variables at the end of a pipeline,
Elmar Stellnberger <=