MH & nmh: Email for Users & Programmers

May, 2006

MH Command-line Switches (Options)

Each MH command has some optional switches you can type on its command line. These switches are in the form of English words. They're called switches because most of them have two settings: on and off. For instance, repl (also the forw and dist commands, covered later) have a -annotate switch. This tells MH to mark the original message with the date and time you replied to (or forwarded or redistributed) the message. To get the "off" setting, you use the word "no" before the switch. For instance, the -noannotate switch tells repl not to annotate a message.

Most switches have default settings (if you don't tell a command whether the switch should be on or off, the default is used). For example, the default for repl is -noannotate.

Unlike many UNIX commands, which have options like -a or -F, the switches for MH commands are longer than a single letter (though you can abbreviate many of them).

Let's try -annotate. Pick another message and send a quick reply to it. For instance, to reply to message 2 and annotate it, you would type:

    % repl -annotate 2
    
Because the order usually doesn't matter, you could also use:
    % repl 2 -annotate
    
Here's more about annotation.

If you want to go into your favorite editor (like emacs) directly, add the editor name, too. You can abbreviate MH switches. For instance, to reply to message 2, annotate it, and use the emacs editor, type one of these commands:

    % repl -annotate -editor emacs 2
    % repl -a -e emacs 2
    
By the way, if you want to use switches like -annotate and -editor xxx every time you reply, without having to type them, you can add them to a repl: entry in your MH profile:
    repl: -annotate -editor xxx
    
Each command's switches are listed in the MH Reference Guide and in the command's online manual page. You may also want to read An MH Profile, in General.

After you've typed your quick reply, you'll be back at the What now? prompt. Type send to send the reply. Then show the original message -- by now, it's the current message, so you can just type show at a percent sign (%) prompt. Because you used -annotate when you replied to this message, there should be a Replied: field in the message header:

    % show
    (Message inbox:2)
    Replied: Mon, 09 Jan 1995 17:09:43 -0600
        ...
    Subject: Another test
    Date: Mon, 09 Jan 1995 16:58:22 -0600
    From: "Joe Doe" <joed>
        ...
    
And when you scan the message, you'll see a dash (-). (Here is the scan line for message 2.) For much more information about replying to mail with repl, look here.