mail-output - run a command and mail back the output


mail-output [--debug] [--empty|-e] [--failure-only|-f] [--help] [--recip|-r addr]... [--sendmail prog] [--subject|-s subj] [--version] command [arg]...


mail-output runs the given command and mails you any output it generates. (If there isn't any output no mail is sent.) If the command exits with a non-zero status mail is always generated.

mail-output ignores hangup (HUP) signals, so the program it runs should do the same. If stdin is a terminal, it's re-opened on /dev/null instead.

I used to hold the output in an unlinked temporary file, but I switched to using a named one so you can look at the it before the command finishes. The file's location and name can vary, but usually it'll be called something like mail-output.* in $TMPDIR or /tmp.



Turn debugging on.


Send mail even if the command doesn't output anything and returns 0.


Don't send the message unless the command exits with a non-zero status.


Show the usage message and die.

--recip address
-r address

Send the mail to address. Multiple instances of this switch can be used to send the mail to more than one person, but only put one address for each instance of --recip. If you don't use this switch the mail will be sent back to you. If you do use this switch then the mail will only go to the addresss you specify.

--sendmail prog

Use prog to send the mail. This program should take the message on standard input and the recipients as arguments. If you don't give this switch mail-output searches for sendmail on your $PATH and in the usual locations.

--subject subj
-s subj

Set the subject used for the mail. The default subject includes the name of the command run.


Show the version number and exit.


Roderick Schertler <>


Hey! The above document had some coding errors, which are explained below:

Around line 294:

You forgot a '=back' before '=head1'