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_fileThen, if you type:
% replx 23the 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.
[Table of Contents] [Index] [Previous: Chapter Introduction (New Versions of MH Commands)] [Next: Making a New Command Version]
This file is from the third edition of the book MH & xmh: Email for Users & Programmers, ISBN 1-56592-093-7, by Jerry Peek. Copyright © 1991, 1992, 1995 by O'Reilly & Associates, Inc. This file is freely-available; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation. For more information, see the file copying.htm.
Suggestions are welcome: Jerry Peek <firstname.lastname@example.org>