MH & nmh: Email for Users & Programmers

May, 2006

Watch Out for the MH Profile

If you use MH commands in your scripts and your script depends on the format of the command's output, you could have trouble if someone edits the MH profile and changes the command's default options. It's usually safer either to give all the command-line options explicitly, right in your shell script, like this:

    show -showproc mhl -noheader ...
    
or to make a temporary MH profile (see the script in the Section Explanation of rmmer for an example).

One special note: in UNIX, many users can share the same shell script. If a shell script uses the default scan output without a format file or format string, the user can change the output (in their MH profile files) and there's no way for you to stop it. In other words, scan doesn't have -noform or -noformat switches to override the user's format. To take care of the problem, you can make your own format file that gives the default scan output and run scan in your scripts with -form scan.default. The format file is in the Section The Default scan Format File.