MEXPECT(8) BSD System Manager's Manual MEXPECT(8)NAMEmexpect - send a string to a device/modem and expect a response
SYNOPSISmexpect [-dsz] [-b baud] [-c count] [-f device] [-r rstring] [-t timeout]
string [expect [...]]
DESCRIPTION
The mexpect program sends string and optionally waits for one of several
expect strings in response. The expect strings are regular expressions
as defined by regex(3).
The optional arguments to mexpect are:
-b Do not send characters any faster than would be sent if the line
was set to the baud rate baud. This allows leaving the line at
higher speeds when talking to a modem that can't keep up while in
command mode.
-c count
Try sending string up to count times.
-d Turn on debug mode. This will cause mexpect to print out each
string sent and received from the device.
-f device
Instead of assuming standard input and standard output, open
device and send all requests and expect all responses from it.
It is quite useful when device is of the form /dev/fd/xx.
-r rstring
Before resending string after a timeout (as indicated by -c),
send rstring.
-s Cause mexpect to print on exit, to standard output, two lines of
the form:
MINDEX='index'
MSTRING='match'
The value of index will either be the index (starting with 0) to
the expect string that was matched. The value of match will be
the string that actually matched the expect string. On error,
index will be set to -1 and match will indicate the error.
If there are no expect strings, then index will be 0 and match
will be empty.
-t timeout
If no expect string is received within timeout seconds, either
resend string (see -c) or exit with a failure.
-z Cause mexpect to expect string to be echoed. Expect will wait
for string to be echoed before looking for one of the expect
strings.
When there are no expect strings defined, mexpect does not wait for any
response, including the echoing of string, even if -z is given.
SEE ALSOregex(3)HISTORY
This command first appeared in BSD/OS 3.0.
AUTHORS
Paul Borman, Berkeley Software Design, Inc.
BSDI BSD/OS March 6th, 1995 2