Steffen Nurpmeso <stef...@sdaoden.eu> wrote, on 26 Jun 2020: > > Andrew Josey wrote in > <660b59c1-98a7-490b-b6dc-391fb7ec5...@opengroup.org>: > |I'm pleased to announce the availability of the first draft of the \ > |202x revision of the standard. > |This draft is the first committee draft. > > ..But related to that as well as to the current version. > I searched for mailx and encountered two instances of > > This sequence, which demonstrates redirecting standard error to > a pipe, is useful in a command procedure (the sequence of output > redirection specifications is significant): > > diff file1 file2 2>&1 >outfile | mailx mygroup > > which effectively sends an empty message to the alias "mygroup". > And i wonder whether this really was the intention.
As per the introductory text, it is demonstrating the use of: ... 2>&1 >outfile | ... to redirect stderr to a pipe (with stdout not going to the pipe). The message is only empty if diff does not report an error. > I would, in the context of the example(s), understand > > diff file1 file2 2>&1 >outfile | > mailx -s "File difference available" mygroup Yes, although the subject line would be misleading if diff reported an error. > This is all rather confusing however. Maybe > > diff file1 file2 2>&1 | > mailx -s "File difference of file1 and file2" mygroup > > was meant. Or > > diff file1 file2 2>&1 | tee outfile | > mailx -s "File difference of file1 and file2" mygroup > > or > > diff file1 file2 2>&1 > outfile; > mailx -s "File difference of file1 and file2" mygroup < outfile None of those demonstrate sending stderr to a pipe with stdout not going to the pipe. The text doesn't state the stdout-not-to-pipe part, but it emphasises the sequencing of the redirections so that's clearly the point of it. > Shall this end up as a doc enhancement request? Since the text hasn't changed in Issue 8 draft 1, if you raise a Mantis issue it should be for the current standard (i.e. choose the Issue7+TC2 project). -- Geoff Clare <g.cl...@opengroup.org> The Open Group, Apex Plaza, Forbury Road, Reading, RG1 1AX, England