Controlling Multiple Processes—kibitz

It is possible to connect more than two processes simply by identifying more than two spawn ids with the -input or -output flags. The kibitz script that comes with Expect does this. First, I will describe kibitz from the user’s point of view.

By default, kibitz runs a shell and connects both the original user and another user to it. The keystrokes of both users are sent to the shell and both users see the results. kibitz is ideal for allowing two people to see what one another is doing. For example, a novice user who is having a problem can use kibitz to let an expert see in real time what is going awry. The expert can begin typing at any time, showing the user the correct way to do something.

Lots of other uses are possible. For example, by running a full-screen editor, two people may carry out a conversation, and have the ability to scroll backwards, save the entire conversation, or even edit it while in progress. People can team up on games, document editing, or other cooperative tasks where each person has strengths and weaknesses that complement one another.

kibitz is started by the first user typing kibitz followed by the user name.

% kibitz debtron

This causes the second user (debtron) to be prompted to run kibitz. The user sees a message in their console asking them to run kibitz. The user sees:

Can we talk?  Run: kibitz -20899

The request includes a special argument to allow the two kibitz sessions to communicate. (In fact, it tells the second ...

Get Exploring Expect now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.