O'Reilly logo

Exploring Expect by Don Libes

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required