[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: SH bahaviour to not fork a subshell after " | while read "
From: |
Chet Ramey |
Subject: |
Re: SH bahaviour to not fork a subshell after " | while read " |
Date: |
Fri, 01 Jun 2012 08:18:40 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:11.0) Gecko/20120327 Thunderbird/11.0.1 |
On 6/1/12 4:53 AM, freD wrote:
> 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
Upgrade. Current versions of bash have a shell option that will allow
you to do this. And bash-3.0 is seven years old.
> Fix:
> May be starting in "sh" mode and/or posix mode should behave like a
> real bourne shell
That's funny. `Real' Bourne shells don't do this. The only reason sh on
your particular system does it is because AIX uses ksh as sh.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/