~ubuntu-branches/ubuntu/trusty/mh-book/trusty

« back to all changes in this revision

Viewing changes to mh/whacom.htm

  • Committer: Bazaar Package Importer
  • Author(s): Peter S Galbraith
  • Date: 2001-03-26 12:42:56 UTC
  • Revision ID: james.westby@ubuntu.com-20010326124256-philz6gf517qz8bo
Tags: upstream-9910
ImportĀ upstreamĀ versionĀ 9910

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<HTML>
 
2
<HEAD>
 
3
<META NAME="Author" CONTENT="Jerry Peek">
 
4
<TITLE>MH &amp; nmh: What's a New Command Version?</TITLE>
 
5
</HEAD>
 
6
<!-- $Id: whacom.htm,v 6.0 1999/10/10 05:14:05 jpeek Exp $ -->
 
7
 
 
8
<BODY BGCOLOR="#FFFFFF">
 
9
<A NAME="index1"></A>
 
10
<H1>What's a New Command Version?</H1>
 
11
[<A HREF="ch-nvomc.htm">previous</A>]
 
12
[<A HREF="makcom.htm">next</A>]
 
13
[<A HREF="tocs/jump.htm">table of contents</A>] [<A HREF="indexes/map.htm">index</A>]
 
14
<P>
 
15
 
 
16
In UNIX, you can give the same command more than one name.
 
17
For instance, typing the command <I>view</I> will run the <I>vi</I>
 
18
program -- but the program will notice that you've run it with the name
 
19
<I>view</I>, so it automatically sets its read-only mode.
 
20
You can do the same thing with MH programs.
 
21
(Besides this chapter,
 
22
there are some good examples in the <I>miscellany/mtrenv</I> directory
 
23
of the MH distribution.)
 
24
<P>
 
25
An MH command will run the same way, no matter what name you give
 
26
it -- but it will look for an entry in your MH profile
 
27
with the name you use to run it.
 
28
<A NAME="index2"></A>
 
29
For example, you can set a second name for the <I>repl</I> command
 
30
called <I>replx</I> (see the directions below).
 
31
Then, add an entry with the new name to your MH profile.
 
32
<PRE>
 
33
repl: -query
 
34
replx: -query -filter <TT><I>filter_file</I></TT>
 
35
</PRE>
 
36
Then, if you type:
 
37
<PRE>
 
38
% <B>replx 23</B>
 
39
</PRE>
 
40
the program will run as if you'd typed
 
41
<TT>repl -query -filter <I>filter_file</I> 23</TT>
 
42
and read a copy of your original message into your draft reply.
 
43
<P>
 
44
New versions are easy to make -- almost as easy as shell aliases.
 
45
Usually, you don't even have to be a programmer.
 
46
(It might help to have a guru "on call" when you do the first setup.)
 
47
The Section
 
48
<A HREF="makcom.htm">Making a New Command Version</A> explains how to make them.
 
49
<P>
 
50
Unlike
 
51
<A HREF="mhanthsh.htm#UsSAaFwM">shell aliases or functions</A>, MH command
 
52
versions can be run by any other MH or UNIX command.
 
53
You can use MH command versions in <I>at</I> or <I>cron</I> jobs, from
 
54
inside a shell script, from another MH command, from a C or <I>perl</I>
 
55
program, and so on.
 
56
Sometimes, though, an alias or function is all you need.
 
57
The Section
 
58
<A HREF="wcvaaof.htm">Writing Command Versions as Aliases or Functions</A>
 
59
tells how to write these versions as an alias
 
60
or function.
 
61
<P>
 
62
 
 
63
<P ALIGN=CENTER>
 
64
[<A HREF="tocs/jump.htm">Table of Contents</A>] [<A HREF="indexes/map.htm">Index</A>]
 
65
[<A HREF="ch-nvomc.htm">Previous: Chapter Introduction (New Versions of MH Commands)</A>]
 
66
[<A HREF="makcom.htm">Next: Making a New Command Version</A>]
 
67
</P>
 
68
<HR>
 
69
<EM>Last change $Date: 1999/10/10 05:14:05 $</EM>
 
70
<P>
 
71
This file is from the third edition of the book <I>MH &amp; xmh: Email
 
72
for Users &amp; Programmers</I>, ISBN 1-56592-093-7, by Jerry Peek.
 
73
Copyright &copy; 1991, 1992, 1995 by O'Reilly &amp; Associates, Inc.
 
74
This file is freely available; you can redistribute it and/or modify
 
75
it under the terms of the GNU General Public License as published by
 
76
the Free Software Foundation.  For more information, see
 
77
<A HREF="../copying.htm">the file <I>copying.htm</I></A>.
 
78
<P>
 
79
<ADDRESS>
 
80
Suggestions are welcome:
 
81
<A HREF="http://www.jpeek.com/">Jerry Peek</A>
 
82
<A HREF="mailto:jpeek@jpeek.com">&lt;jpeek@jpeek.com&gt;</A>
 
83
</ADDRESS>
 
84
</BODY>
 
85
</HTML>