Programs that use MH commands don't have to be interpreted by the Bourne
shell, of course.
An MH command may be run by any language that will start a UNIX process and can:
Pass command-line arguments to the process.
Pass environment variables to it.
Pass text to the standard input of the process and read its standard output.
In a lot of cases, the program will do its own processing of
text output by MH commands.
For instance, Perl is good at parsing the headers of email messages.
So, instead of using MH format strings, a Perl script might use
show -noshowproc or mhpath to read a message header into
an array -- then use Perl regular expression operators to get the
information you need.
When you're trying to decide whether to use MH features or the features
of your language, how do you choose?
Get familiar with all the features of MH.
Compare them to the features in the languages you might choose as a
"wrapper" around MH commands.
MH was designed for use in programming, so there are lots of "hooks" for
programming.
Knowing about these hooks can save you a lot of time "re-inventing the
wheel" in another language.
Think about efficiency.
On many systems, especially busy ones, getting a UNIX process started
takes a lot of time.
Can you design an
MH command version
that does what you
need -- without starting a "wrapper" process around the MH command?
How much clock time does your "wrapper" need to start running
before it executes the MH command?
On the other hand, can your interpreter do the work of several MH commands
in its own single process, thereby saving execution time?