bug-bash
[Top][All Lists]
Advanced

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

Is there a way to force here-documents/strings to use temporary files?


From: Oğuz
Subject: Is there a way to force here-documents/strings to use temporary files?
Date: Sun, 20 Dec 2020 10:25:12 +0300

Before Bash-5.1 I used to be able to do things like this and get consistent
results:

    $ { grep -x -m1 1; grep -x 2; } <<<`seq 3`
    1
    2
    $ { grep -x -m1 1; grep -x 2; } <<<`seq 30000`
    1
    2

But now, since here-documents use pipes when the expanded document is
smaller than the pipe buffer size, grep can't position stdin and this
doesn't work consistently anymore. See:

    $ echo $BASH_VERSION
    5.1.0(18)-maint
    $
    $ { grep -x -m1 1; grep -x 2; } <<< `seq 3`
    1
    $ { grep -x -m1 1; grep -x 2; } <<< `seq 30000`
    1
    2

So, is there any way to force here-documents to use temporary files no
matter how long the expanded document is? If not, it would be nice if
compat50 had this effect.

Oğuz


reply via email to

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