sexpect icon indicating copy to clipboard operation
sexpect copied to clipboard

Expect for Shells

What's sexpect

sexpect is another implementation of Expect which is specifically designed for Shell scripts (sh, bash, ksh, zsh, ...).

sexpect is designed in the client/server model. sexpect spawn PROGRAM [option].. starts the server (running as a daemon) and runs the specified PROGRAM in background. Other sexpect sub-commands (send, expect, wait, ...) communicate to the server as client commands.

How to build

Sexpect uses CMake for building.

$ cd /path/to/cloned/sexpect/
$ mkdir build
$ cd build
$ cmake ..
$ make
$ make install

By default it will install to /usr/local/ and sexpect will be installed to /usr/local/bin/. To change the installation location, run cmake like this:

$ cmake -D CMAKE_INSTALL_PREFIX=/opt/sexpect  ..

Supported platforms

Tested on:

  • OpenWRT 15.05.1, ramips/mt7620 (on Newifi Mini, or Lenovo Y1 v1)

  • Debian Linux 9 (Stretch)

  • macOS 10.13 (High Sierra)

  • FreeBSD 11.1

  • Cygwin on Windows 10

Manual

See doc/sexpect.adoc.

Examples

See the examples/ dir.