Hi,

On Mon, Sep 21, 2020 at 09:13:13PM -0400, Dale R. Worley wrote:
> Andreas Schwab <sch...@linux-m68k.org> writes:
> I assume that if you really want the old effect, you can still do
> 
>     exec {dup}<&1
You mean:
    exec {dup}<&0

> 
>     ... <( ... <$dup ) ...
and:

... <( ... <&$dup ) ...

> 
>     exec {dup}<&-
> 
> Dale
Sample:

This worked under previous bash versions (I use 5.0.3(1)-release):

testForkInput () {
    local line 
    while read line ;do
        echo "$line" 
    done < <(
        sed 's/^/> /'
    )
}

But with 5.1.0(1)-beta, I have to replace this with:

testForkInput () {
    local dup line
    exec {dup}<&0
    while read line ;do
        echo "$line"
    done < <(
        sed 's/^/> /' <&$dup
    )
    exec {dup}>&-
}

testForkInput < <(seq 1 5)
> 1
> 2
> 3
> 4
> 5

On Tue, Sep 22, 2020 at 08:57:57AM +0200, Andreas Schwab wrote:
> That point is that it silently breaks existing scripts.

I agree.

-- 
 Félix Hauri  -  <fe...@f-hauri.ch>  -  http://www.f-hauri.ch

Reply via email to