Columbia MM
MM Manual

PERFORMING A SET OF COMMANDS IN ONE STEP: TAKE

If you find that you type a certain sequence of commands repeatedly, you can write a script, a file containing the commands, and run the script with the take command.


THE TAKE COMMAND

You can specify one, two or three filenames with the take command.

MM completes a take and returns control to your terminal when it reaches the end of the command file, or when an error occurs, or when it finds the command take on a line by itself in the command file. Use the last method to end a take cleanly with no error messages.

The commands have to be possible commands for the MM mode you are in when you use the take command: Top-Level, Read and Send, indicated by the MM>, R> and S> prompts. For example, commands with a message-sequence can be used only at Top-Level (the MM> prompt). Some commands do not even exist in all three modes; Send Mode in particular has many different commands from the other two.


AN EXAMPLE OF THE TAKE COMMAND

Suppose you regularly move mail from certain people from mbox to other mail files. Shown below is a command file, mailsort, and then its use with a take command:



move from fuat mm.mail
move from melissa mm.mail
move from dcl cons.mail
echo Mail from Fuat, Melissa and Don has been moved.
take




MM>take mailsort
 3,10
 6,15:16
 4,7
 Mail from Fuat, Melissa and Don has been moved.
MM>


When the command is used, the numbers that appear are the results of the move commands. The echo command puts a message on screen confirming what was just done.

Using a second filename with the take command would have sent the commands and output to a file; for example, take mailsort mailsort.out. On screen you would then see a slight pause while the command ran, and then another MM> prompt, nothing else. The file mailsort.out would contain each command in mailsort followed by its results. If an error occurred, however, you would see the error message on the screen, and the take would stop at the point where the error occurred.

This display of commands and results would appear on screen, instead of in a file, if you gave the command as take mailsort /dev/tty.


TIPS FOR TAKE FILES

The command echo just puts text on the screen. Its only important use is with take command files, as shown above, where it can be very helpful in reminding the user what the take is doing.

The command blank blanks the screen and places the cursor at the upper left corner. You might use it in a take command file for effect.

You can insert a comment into a take command file by putting a # sign anywhere in a line. MM will ignore anything from the # sign to the end of the line.

The character control-v is an escape character; it means that the next character should be taken literally rather than as a command. The only characters that need an escape are other control characters and other non-printing characters.

Put the following nonsense into a file, and then use take to run the commands. Notice what happens from use of the blank and echo commands, the # sign, and control-v. (Note, if you are using Emacs, the way to type the control characters in the last line is to type c-q c-v c-q c-g, which will appear on screen as ^V^G. Control-g in text sounds the bell (beep) on a terminal.)



blank
echo Did the blank command.
#This is just a test file.
echo Got past the comment line without showing it.
echo Inserting a ^V^G bell here.
take



MACROS (DEFINED COMMANDS)

MM currently does not have macros. A macro would let you, in some way, define your own command. The closest available facility is to take a file, so you need to type at least ta, space, and one more letter to call up a predetermined set of commands.


[ Columbia MM Manual ]