# MH Shell on a Mailbox File: msh

The files written by packf and rcvpack can be handled by the MH mail shell, msh. msh may also be able to read your system mailbox.

## Overview of msh

msh is a monolithic user agent -- the kind of program you thought you got away from when you decided to use MH! `:-)` Seriously, besides reading packed files, msh can be a good place for beginners to learn MH. That's because the only commands msh understands are MH commands.

The commands your msh supports depend on your msh version. Some of the commands don't have all the features the corresponding MH command does. Check your online manual page, type `?` for help at an msh prompt, or just try the command -- if what you want won't work, msh will tell you. The error messages start with `say what:`.)

Here's a sample short msh session:

        % msh
        Reading ./msgbox, currently at message 1 of 4
        (msh) scan
           1+ 04/24 mary@hahvahd.edu   rcvtty -- how do I use it?<<I've been
           2  11/23 Al Bok             Query about "repl -query"<<I have a q
           3  02/09 "Wilbur, Orville"  X Terminal Presentation/Demonstration
           4  02/11 To:"Wilbur, Orvil  Re: X Terminal Presentation/Demonstra
        (msh) show
        (Message 1)
            ...Message 1 appears...
        (msh) rmm
        (msh) refile 2 +questions
        Create folder /yourMHdir/questions? y
        (msh) quit
        Update file "./msgbox"? y
        %

By default, msh reads a file named msgbox in your current directory. You can use a different filename by typing `-file packedfile` on the msh command line. One thing you might not expect is that refile does not write another packf format file. Instead, it writes to a standard MH folder. This is a nice way to move some messages out of a packed message file. To leave, type `q` or `quit`. msh will ask whether changes you've made, with commands like rmm and refile, should be made permanent. If you answer `n`, your packed message file won't be modified.

## Handling New Mail with msh

If your system uses the MMDF transfer agent, msh can read incoming mail without a problem. On systems with sendmail, though, your system mailbox will look like one long message to msh. You can always inc your mail into a normal MH folder from outside msh and then use packf to bundle the messages for msh. Or, to get a mailbox file in the format msh wants, automatically, set up a .maildelivery file like this:

        # Put all incoming mail into $HOME/msgbox for msh:
        *  -  ^  ?  "/usr/local/lib/mh/rcvpack msgbox"

In MH 6.8 and above, the next version will be more efficient:

        # Put all incoming mail into $HOME/msgbox for msh:
        *  -  mbox  ?  msgbox

If inc uses POP to incorporate mail from a remote server, you can use inc -pack filename to incorporate new mail into a file that msh can read. For example, inc -pack msgbox would write to msgbox.

## msh and Your MH Profile

If you've done some customization in your MH profile, it can affect msh in unusual ways. If your MH profile is as complicated as mine, you should probably set the MH environment variable before you run msh. Make MH point to an alternate simple MH profile. Something like the xmh setup in the Section Conflicts Between xmh and MH Customization should be fine.