On 2025-04-01 15:49, Theo Buehler wrote:
> On Tue, Apr 01, 2025 at 10:43:57AM -0500, Tim Chase wrote:
>> mail(1) also supports the "pipe" command (also known as "|") as
>> registered in "cmdtab.c" line 63-64 and it works fine, but the
>> man-page lacks documentation for this command (which I would expect
>> to see between the help for "next" and "Preserve").
>
> It's documented in the 'Recipient address specifications' section:
>
> An address that starts with a pipe ("|") character is treated as
> a command to run. The command immediately following the "|" is
> executed with the message as its standard input.
That's...unfortunate and misleading placement?
That section discusses the use of the pipe in *recipient* fields:
Recipient addresses (any of the "To", "Cc" or "Bcc" header fields) are
subject to expansion when the expandaddr option is set.
So I'd expect this is documenting something like
$ mail -f openbsd-bugs.mbox
Mail version 8.1.2 01/15/2001. Type ? for help.
"openbsd-bugs.mbox": 1 message 1 new
>O 1 tb theobuehler ! Tue Apr 01 15:49 20/1005 Re: mail(1) man page
doesn't document the "pipe" command
& mail theobuehler |bugs-processing.sh
to have it send a copy of my message through a "bugs-processing.sh"
script. However, that also seems to be broken since it appears that
mail(1) sends this directly along to the sendmail-ish (smtpd), which
grouses something like:
sendmail: command failed: 550 Invalid recipient:
<|[email protected]>
without passing it through the script.
The context in question here isn't in one of those header-fields but
rather at the command-prompt itself:
$ mail -f openbsd-bugs.mbox
Mail version 8.1.2 01/15/2001. Type ? for help.
"openbsd-bugs.mbox": 1 message 1 new
>O 1 tb theobuehler ! Tue Apr 01 15:49 20/1005 Re: mail(1) man page
doesn't document the "pipe" command
& pipe rot13
The other commands listed in that cmdtab.c:63 table, are documented in
the SUMMARY section of the man-page, but the "pipe" (and "|" alias)
are missing from that man-page section. I noticed a couple other
undocumented commands from that table like
- "group" (an alias for "alias")
- "discard" (an alias for "ignore")
- "new" (marks a read-message as new)
but "pipe"/"|" was the one that sent me poking around to find out more.
-tkc
--