Columbia MM
MM Manual

GIVING COMMANDS TO THE SHELL

You may want to use UNIX shell commands (that is, commands you usually give at the UNIX shell prompt) in connection with work in MM. A shell command may be a built-in command or it may be the command to execute a program. One way is to suspend MM, do the commands at the shell prompt, and then continue the MM process; there are other ways. The simplest is to use an exclamation point.


USING ! WITH A UNIX SHELL COMMAND

The easiest way to run one shell command from MM is to type an exclamation point followed by the command. For example, suppose you want to check a BITNET address by giving a grep command on the file of BITNET nodes:



MM>!grep -i Fordham /usr/local/doc/bitnet/nodes.info1
FORDMRH1  Fordham University - VAX 11/785 Rhoda     VMS 5.2
FORDMULC  Fordham University Computer and Informat  VMS
FORDMURH  Fordham University Computer and Informat  VMS
MM>


One command you don't need to give with ! is ls. Instead, type a question mark at the file prompt. For example, if you want to include a file in a message and realize you forgot its name, give the control-b command to insert it and then type ? at the prompt. You'll see a list of files. You could also type a directory name followed by /? to see the files in that directory.



[control-b]
Insert file: ? Confirm to cancel
  or filename, one of the following:
 albert                   clover
 mbox                     mbox~
 springmotor              umbrella
Insert file:



SUSPENDING

You can suspend MM at any point with the command z (suspend) or with control-z. If you want to give a series of commands to the shell, suspending MM and running them from the shell prompt is faster than giving a series of commands to MM with exclamation points. For an example, here is just that same grep command again.



MM>z
[1] + Stopped (signal)         /usr/local/bin/mm
$ grep -i Fordham /usr/local/doc/bitnet/nodes.info1
FORDMRH1  Fordham University - VAX 11/785 Rhoda     VMS 5.2
FORDMULC  Fordham University Computer and Informat  VMS
FORDMURH  Fordham University Computer and Informat  VMS
$ mm
/usr/local/bin/mm
MM>


While the suspend command can be used from any MM prompt, control-z can be used from almost any point at all, like the middle of a command line or the middle of writing a message. When you return from control-z, you do not see a prompt, but MM is at exactly the point where you left it. Use control-r to redisplay the current line so you can see where you are.



The right BITNET address to use is [control-z]
[1] + Stopped (signal)         /usr/local/bin/mm
$ grep -i Fordham /usr/local/doc/bitnet/nodes.info1
FORDMRH1  Fordham University - VAX 11/785 Rhoda     VMS 5.2
FORDMULC  Fordham University Computer and Informat  VMS
FORDMURH  Fordham University Computer and Informat  VMS
$ mm
/usr/local/bin/mm
[control-r]
The right BITNET address to use is



PUSHING TO A SUBSHELL

An alternative to suspending is to start a subshell from MM. A shell is considered a subshell when it is started under another process.

The MM command to start a subshell is push. Use the exit command to end the subshell.



MM>push
Pushing to subshell, use "exit" to return to MM
$ grep -i Fordham /usr/local/doc/bitnet/nodes.info1
FORDMRH1  Fordham University - VAX 11/785 Rhoda     VMS 5.2
FORDMULC  Fordham University Computer and Informat  VMS
FORDMURH  Fordham University Computer and Informat  VMS
$ exit
MM>


This may look similar to suspending, but what happens in the system is quite different. If you suspend MM, you go to the parent shell from which you started MM, which is very probably the login shell, the one you started when you logged in. If you push to a subshell, you go to a new child shell.

A synonym for push is the exclamation point by itself. As you may suspect from that, giving a command like !grep is equivalent to a push, grep and shell exit. It is of course less keystrokes for you to type ! and the command, but suspending is actually more efficient for the system, since it avoids starting a new process. Using ! probably wins when you want to do one command, but a series of commands with ! is the slowest choice since each one starts its own subshell.

The directory commands cd and pwd should be given to the right shell if you intend to get the right results. Suspending and then using pwd gives you the current directory of the parent shell, which might be something you would want to know, while pushing and using pwd, or doing !pwd in MM, tells you the current directory of the child shell, which is the same as the current directory of the MM process and therefore not worth starting a subshell to find out.


[ Columbia MM Manual ]