MH & nmh: Email for Users & Programmers
Running an MH Command
This section explains what happens when you run an MH command,
step by step. (This also applies when a front-end runs an MH
command for you.)
To help with the explanation, assume that you type the command:
% scan -noheader picked +inbox
and that your MH profile has the entry:
scan: -form scan.size -header
The steps are:
UNIX searches for the scan program file and starts it
One of the first things scan does is to find the MH
profile file. The Path: entry in the MH profile has the
name of your MH directory. (The MH directory is usually
named Mail. The Section Changing MH
Directory Name has more information.)
The command checks your MH profile for entries with the exact
command name. The settings in this entry override the
default scan settings. In this example, for instance,
the -form scan.size overrides
scan's default format. Also, scan defaults
to -noheader, but the -header in your MH profile
overrides that default. So now, by default, scan will
print a heading over the listing.
Command-line parameters (-noheader picked +inbox) are
read. Any switches override the corresponding default and MH
profile switches. So in this example, -noheader wins the
"battle of the switches" and will be used when scan runs.
Some arguments can't be used more than once. For instance, if
you store this entry in your MH profile:
and also give a folder name on the command line, this happens:
% inc +otherfolder
inc: only one folder at a time!
The command looks in your MH directory for
the file named context. This is where your current folder
name and some other information are stored (see your online
mh-profile(5) manual page).
The command looks in your folder for
the .mh_sequences file. This file holds the message
number sequences like cur (the current message number)
and, in this example, picked.
The command scans and displays your folder.
If the command succeeds, it changes the current folder and
current message (if needed). Commands like:
% show 1234 +inbox
usually won't change the current folder to inbox, or the
current message to 1234, if there isn't a message number 1234 in
This file is from the third edition of the book MH & xmh: Email
for Users & Programmers, ISBN 1-56592-093-7, by Jerry Peek.
It is freely available; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation. For more information,