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