[Top][All Lists]

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

Re: Severe Bash Bug with Arrays

From: Chet Ramey
Subject: Re: Severe Bash Bug with Arrays
Date: Wed, 25 Apr 2012 11:07:57 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:11.0) Gecko/20120327 Thunderbird/11.0.1

On 4/25/12 10:55 AM, Greg Wooledge wrote:
> On Wed, Apr 25, 2012 at 08:40:11AM -0400, Chet Ramey wrote:
>> Since you're using bash-4.2, you can experiment with the `lastpipe' shopt
>> option.  If that's enabled, bash runs the last element of a pipeline in
>> the parent shell context without creating a subshell.
> I actually started writing a response that mentioned that, but when I
> was testing it, it didn't seem to work.
> The manual says job control has to be off, so I did it as a script:
> imadev:~$ cat foo
> #!/bin/bash
> set +m
> shopt -s lastpipe
> echo hi | read foo
> echo "<$foo>"

z4.local(1)$ cat x3
#! ../bash-4.2-patched/bash
shopt -s lastpipe

echo foo | read bar
echo $bar
z4.local(1)$ ../bash-4.2-patched/bash -c 'echo $BASH_VERSION'
z4.local(1)$ ../bash-4.2-patched/bash ./x3
z4.local(1)$ ./x3

The set +m doesn't matter, since scripts do not have job control enabled
by default.  Adding it doesn't change the behavior.

``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/

reply via email to

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