bug-bash
[Top][All Lists]
Advanced

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

SH bahaviour to not fork a subshell after " | while read "


From: freD
Subject: SH bahaviour to not fork a subshell after " | while read "
Date: Fri, 1 Jun 2012 10:53:22 +0200

Configuration Information [Automatically generated, do not change]:
Machine: powerpc
OS: aix5.1
Compiler: xlc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='powerpc'
-DCONF_OSTYPE='aix5.1' -DCONF_MACHTYPE='powerpc-ibm-aix
5.1' -DCONF_VENDOR='ibm' -DLOCALEDIR='/opt/freeware/share/locale'
-DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H  -I.  -I. -I
./include -I./lib  -I/opt/freeware/include -O2
uname output: AIX tsm 1 6 00C530EB4C00
Machine Type: powerpc-ibm-aix5.1

Bash Version: 3.0
Patch Level: 16
Release Status: release

Description:

In bash mode, variable are lost after a while loop:

bash-3.00# T=toto ; du | while read a ; do   T=$a ; done ; echo $T
toto

I can keep then a little using parenthesis:

bash-3.00# T=toto ; du | (while read a ; do   T=$a ; done ; echo $T) ; echo $T
1489648 .
toto

Repeat-By:

bash-3.00# T=toto ; du | while read a ; do   T=$a ; done ; echo $T
toto

Fix:
May be starting in "sh" mode and/or posix mode should behave like a
real bourne shell

bash-3.00# /usr/bin/sh
# T=toto ; du | while read a ; do   T=$a ; done ; echo $T
1489632 .
# exit
bash-3.00#



~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]