As you saw in the Section They Won't Always Work, aliases and shell functions can't be used everywhere that command versions can. Sometimes, though -- especially for commands that you'll never use from anywhere except a shell prompt -- an alias or function is all you really need.
To write a command version from this chapter as an alias or function:
alias tscan 'scan -form scan.timely'When you run a C shell alias, the shell will use any arguments you type after the alias name as arguments to the command in the alias. What I mean is, if you use the tscan alias above and type:
% tscan +reports last:20the shell will run:
scan -form scan.timely +reports last:20That alias trick will work with all the command versions in this chapter that can be done as an alias. When you write a shell function, though, you need to include the arguments with $*. Here's tscan as a Bourne shell function:
tscan() { scan -form scan.timely $* }Most command versions in this chapter can be written as an alias or function. The prompter version in the Section Append Text with prompter.nopre and the send version in the Section Version of send: push can't because they're run directly by other MH commands.
[Table of Contents] [Index] [Previous: Making a New Command Version] [Next: Versions of repl]
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 <jpeek@jpeek.com>