On 3/18/25 10:45 AM, Geoff Clare via austin-group-l at The Open Group wrote:

Notable shells that do it this way are bash and ksh, including in POSIX
mode, so if a change is made here, that is probably worth calling out
explicitly.

Those shells also print "hello" without the redirection:

$ sh -c 'set +m; echo hello | { cat & wait; }'  # sh here is bash
hello
$ ksh93u+m -c 'set -o posix; set +m; echo hello | { cat & wait; }'
hello

So this has nothing to do with 0<&0 - it's a non-conformance with the
non-job-control asynchronous AND-OR list requirements in some
circumstances.

I did some digging, and I changed bash to treat pipes as identical to
input redirections in this circumstance back in January, 2016. It's
ironic that the example used to report the bug was almost identical to
your example above. The disucssion starts here:

https://lists.gnu.org/archive/html/bug-bash/2016-01/msg00062.html

One of the factors in my changing bash was for ksh compatibility, plus
the fact that it's more consistent with users' expectations.

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    [email protected]    http://tiswww.cwru.edu/~chet/

  • [1003.1(20... Austin Group Issue Tracker via austin-group-l at The Open Group
    • Re: [... Harald van Dijk via austin-group-l at The Open Group
      • R... Geoff Clare via austin-group-l at The Open Group
        • ... Harald van Dijk via austin-group-l at The Open Group
          • ... Geoff Clare via austin-group-l at The Open Group
            • ... Harald van Dijk via austin-group-l at The Open Group
              • ... Geoff Clare via austin-group-l at The Open Group
              • ... Harald van Dijk via austin-group-l at The Open Group
              • ... Steffen Nurpmeso via austin-group-l at The Open Group
              • ... Chet Ramey via austin-group-l at The Open Group
            • ... Chet Ramey via austin-group-l at The Open Group
          • ... Chet Ramey via austin-group-l at The Open Group
        • ... Lawrence Velázquez via austin-group-l at The Open Group
          • ... Harald van Dijk via austin-group-l at The Open Group
  • [1003.1(20... Austin Group Issue Tracker via austin-group-l at The Open Group
  • [1003.1(20... Austin Group Issue Tracker via austin-group-l at The Open Group
  • [1003.1(20... Austin Group Issue Tracker via austin-group-l at The Open Group
  • [1003.1(20... Austin Group Issue Tracker via austin-group-l at The Open Group
  • Fwd: Re: [... Chet Ramey via austin-group-l at The Open Group
    • Re: F... Geoff Clare via austin-group-l at The Open Group
      • R... Chet Ramey via austin-group-l at The Open Group

Reply via email to