MH & nmh: Email for Users & Programmers

May, 2006

Caution About MH Files and Newline Characters

MH commands expect their files, like the MH profile, to end with a newline character. (In general, you get a newline when you're using a text editor and press RETURN.) The vi editor will automatically terminate the last line with a newline character. Some other editors, including GNU Emacs, may not always put a newline at the end. When you edit an MH file, be careful about this.

A file that doesn't end with a newline can put MH commands like inc into an endless loop. If your MH commands "freeze," be sure that your MH files end with a newline. You can use a UNIX command such as:

    % tail -1 file | od -c

    000000   s   h   o   w   p   r   o   c   :     m   h   l  \n
to see exactly how a file ends -- the last character should be \n.