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.
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.
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