What's a New Command Version?

In UNIX, you can give the same command more than one name. For instance, typing the command view will run the vi program -- but the program will notice that you've run it with the name view, so it automatically sets its read-only mode. You can do the same thing with MH programs. (Besides this chapter, there are some good examples in the miscellany/mtrenv directory of the MH distribution.)

An MH command will run the same way, no matter what name you give it -- but it will look for an entry in your MH profile with the name you use to run it. For example, you can set a second name for the repl command called replx (see the directions below). Then, add an entry with the new name to your MH profile.

    repl: -query
    replx: -query -filter filter_file
    
Then, if you type:
    % replx 23
    
the program will run as if you'd typed repl -query -filter filter_file 23 and read a copy of your original message into your draft reply.

New versions are easy to make -- almost as easy as shell aliases. Usually, you don't even have to be a programmer. (It might help to have a guru "on call" when you do the first setup.) The Section Making a New Command Version explains how to make them.

Unlike shell aliases or functions, MH command versions can be run by any other MH or UNIX command. You can use MH command versions in at or cron jobs, from inside a shell script, from another MH command, from a C or perl program, and so on. Sometimes, though, an alias or function is all you need. The Section Writing Command Versions as Aliases or Functions tells how to write these versions as an alias or function.