fork
Creates a new process.
The new process is
an exact copy of the current Expect process.
On success, fork returns
0 to the new (child) process and returns the process ID of
the child process to the parent process. On failure (invariably due
to lack of resources, e.g., swap space, memory), fork
returns -1 to the parent process, and no child process is created.
Forked processes exit via
the exit command, just like the original process.
Forked processes are allowed to write to the log files. If you do
not disable debugging or logging in most of the processes, the result can
be confusing.
Some pty implementations
may be confused by multiple readers and writers, even momentarily.
Thus, it is safest to fork before spawning processes.
This material is excerpted
from the O'Reilly book "Exploring Expect" by Don Libes and from teh Solaris
manpage
|