MH & nmh: Email for Users & Programmers

May, 2006

Explanation of mhprofile

This program is mostly for MH systems before version 6.8. If you have MH 6.8 or later, you'll probably want to use mhparam instead. The Section Settings from the MH Profile gives an overview of this script. Here is the mhprofile script (you might want to open it in a separate browser window). To install it, see the Section Programs in This Book's Archive.

This program returns two different nonzero exit statuses -- the same way that grep(1) does. The calling program might want to know the difference. If mhprofile doesn't find a matching entry in the MH profile, it returns status 1. If there was some other error (like an invalid option), mhprofile returns 2.

Set the grep variable to the pathname of a program that has a -i (case-insensitive search) option and handles regular expressions. If you don't have a grep which does that, get a freely-available alternative like the GNU version from the Free Software Foundation.

The profile shell variable holds the pathname of the MH profile. It's a bad idea to assume that the user always wants to use .mh_profile in the home directory. If the MH environment variable has been set, this script uses that pathname instead of the default.

This script doesn't handle profile entries that are more than one line long (that contain a newline character, that is). That's because grep will only return the line that starts with the matching entry name.