Bash bug?

Jeff Vian jvian10 at charter.net
Wed Sep 28 22:25:36 UTC 2005


On Wed, 2005-09-28 at 06:36 -0700, BRUCE STANLEY wrote:
> I can't remember the title of the clasic KSH book we used in the good old days
> (it was white with blue lettering if I remember right), but I
> do not remember it ever saying that ENVs would be local within
> a 'while' loop.  Until Linux, I never had this problem with ksh.
> 
> I don't know if that was the case though with bsh (original bourne shell)
> as we never used it.
> 

Not the while loop, (that is not scope limiting by itself,) but the
'cat' subshell structure (cat with the output piped to the while loop).
In bash it seems to be a subshell and does limit env scope, in ksh it
seems not to be. (At least in my testing on AIX.)

> 
> 
> 
> --- Jeff Vian <jvian10 at charter.net> wrote:
> 
> > On Mon, 2005-09-26 at 14:42 -0700, BRUCE STANLEY wrote:
> > > Then this is a departure from original/standard System V
> > > behaviour. Again, all System V based Unixes I have programmed
> > > under did have this behaviour.
> > > 
> > > Anyone converting scritps (as I had to do) will run into
> > > this problem/behaviour.
> > > 
> > BTW,  On AIX when I tried using bash I had the same effect as I did on
> > Linux.  When I tried it with ksh the results were as you obviously
> > expected.  The subshell for the cat command was able to modify the
> > values of the variable in the parent.
> > 
> > 
> > 
> > > 
> > > 
> > > --- Tim Waugh <twaugh at redhat.com> wrote:
> > > 
> > > > On Mon, Sep 26, 2005 at 06:15:21AM -0700, BRUCE STANLEY wrote:
> > > > 
> > > > > This seems to be a Linux issue with the shells.
> > > > 
> > > > It is correct behaviour, and POSIX-compliant to boot.
> > > > 
> > > > Please see the bash FAQ, question E4.
> > > > 
> > > >   /usr/share/doc/bash-3.0/FAQ
> > > > 
> > > > Tim.
> > > > */
> > > > > -- 
> > > > fedora-list mailing list
> > > > fedora-list at redhat.com
> > > > To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
> > > 
> > 
> > -- 
> > fedora-list mailing list
> > fedora-list at redhat.com
> > To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
> > 
> 




More information about the fedora-list mailing list