MH & nmh: Email for Users & Programmers

May, 2006

Settings from the Environment

When an MH command runs, it may set some environment variables to be used by programs it calls. For example, when repl starts its -editor program, the editor can get the value of $editalt from the environment; it holds the pathname of the original message.

The Table below is taken from the mh-profile(5) manual page. For more description of each environment variable, read your online copy of it. The table doesn't include MH environment variables set by parts of MH which this book doesn't cover, such as BBoards. In this table, a "full pathname" means a pathname starting at the root directory like /yourMHdir/inbox/4.

Table: Environment Variables that MH Sets

editalt (set by dist, repl)
Full pathname of message being distributed or replied to.
mhaltmsg (set by dist, repl)
Full pathname of message being distributed or replied to.
mhannotate (set by dist -anno, forw -anno, repl -anno)
If -annotate is used, set to annotation string for original message header: Resent:, Forwarded:, or Replied:.
mhdist (set by dist)
Contains 1 if draft message is being distributed (signal not to allow text in the draft body), 0 otherwise.
mhdraft (set by comp, dist, forw, repl)
Full pathname of the draft message.
mheditor (set by all commands)
Full pathname of text editor program.
mhfolder (set by dist, forw, repl, show, prev, next)
Full pathname of folder that holds the alternate message.
mhinplace (set by dist, forw, repl)
Set to 1 if -annotate -inplace used, to 0 if -annotate is used.
mhmessages (set by dist -anno, forw -anno, repl -anno)
List of message number(s) to annotate; for example, 23-25 34.
mhuse (set by comp)
Set to 1 during comp -use; 0 otherwise.
MHFD (set by all commands)
File descriptor of MH profile (experimental) (only if OVERHEAD configuration option set).
MHCONTEXTFD (set by all commands)
File descriptor of MH context (experimental) (only if OVERHEAD configuration option set).