OnWorks favicon

expect-lite - Online in the Cloud

Run expect-lite in OnWorks free hosting provider over Ubuntu Online, Fedora Online, Windows online emulator or MAC OS online emulator

This is the command expect-lite that can be run in the OnWorks free hosting provider using one of our multiple free online workstations such as Ubuntu Online, Fedora Online, Windows online emulator or MAC OS online emulator



expect-lite - a quick and easy command line automation tool


expect-lite [-vv] -c <script> [-r <host>] [CONSTANT=value] [*DIRECTIVE] [-h|--help]
script.elt [-vv] [r=<host>] [CONSTANT=value] [*DIRECTIVE] [-h|--help]


Written in Expect, it is designed to directly map an interactive terminal session into an
automation script. expect-lite scripts use punctuation character(s) at the beginning of
each line to indicate the action. Basic expect-lite scripts can be created by simply
cutting and pasting text from a terminal window into a script, and adding > < characters.
Knowledge of Expect is not required.

usage: expect-lite remote_host=<remote_host_IP> cmd_file=<command_file>
[user_dir=<user_dir>] [const1=value1] [*DIRECTIVE]

or short form: expect-lite r=<remote_host_IP> c=<command_file> [d=<user_dir>]
[const1=value1] [*DIRECTIVE]

eg. ./expect-lite r=host-008 c=pm_alt.elt d=/local/sw myvar=myvalue *NOCOLOR

additional login options: user_name=<username> user_password=<password>

eg. ./expect-lite r=host-008 c=pm_alt.elt u=superuser p=mysecret

additional debug options: -v|-vv|--verbose

-v prints warnings, and infos (i.e. conditionals, dynamic var assignments)

prints warnings and debug (i.e. expect match info)

eg. ./expect-lite -v r=host-008 c=pm_alt.elt

user defined help options: -h|--help

displays user defined help text (demarcated by ;;;) and variables defined in script
which can be overridden by constants on the command line


This is just a brief synopsis of expect-lite commands to serve as a reminder to those
who already know expect-lite; other documentation (such as the html document) must
be consulted for more complete descriptions.

Special Characters
> wait for a prompt, then send string to the remote host

>> send string to remote host, without waiting for prompt

< string/regex MUST be received from the remote host in the allotted timeout or the
script will FAIL!

<< literal string MUST be received (similar to '<' without regex evaluation)

-< NOT expect, if string/regex IS received from the remote host the script will FAIL!

~< fuzzy expect, expect an approximate number (decimal or hex)

# used to indicate comment lines, and have no effect

; are also used to indicate comment lines, but are printed to stdout (for logging)

;<colour> comment
add custom colour comment lines, colour may be blue, ltblue, gray, ltgray, cyan,
black, pink, purple, red, green, yellow

;; similar to above, but no extra newlines are printed (useful for printing script

;;; marks beginning and ending of a block of help text. Help Text is user defined help
for a script and is printed when -h or --help is on the command line

@num changes the expect timeout to num of seconds

:num sleeps for num seconds. Mili-seconds also supported e.g. :1.005 is 1005 mili-

$var= static variable assignment at script invocation. Variable names limited to letters,
numbers, and underscore

+$var= dynamic variable assignment

+$var increment value of $var by 1 decimal

-$var decrement value of $var by 1 decimal

=$var math functions, perform bitwise and arithmetic operations: << >> & | ^ * / % + -
(see math functions)

=$str string math functions, if $str is a string, perform string operations:
//search/replace/ + - (see string math functions in documentation)

! indicates an embedded expect line

? c-style if/then/else in the format ?cond?action::else_action. code block are also
supported in the action and else_action statements. e.g.
?if $i < $n ? [
>send string
<expect string
>send else string
<expect else string

[ While Loop, using code blocks e.g.
[ $i < $n

Foreach Loop, using code blocks, each iteration $item is assigned the next item in
the list. List must be space delimited e.g.
$thelist=ab cd ef
[ $item=$thelist
>echo $item

% label - used for jumping to labels

~filename [constant=value] [constant=value with spaces]
includes a expect-lite script file, useful for creation of common variable files,
or 'subprograms/subroutines'. Can pass optional parameters which will override (as
constants) the variables in the include file. Constant values passed may have
spaces, no quotes are required

Include a fail script, which expect-lite runs only if the main script fails

Set a user defined prompt (defined in regex)

Immediately terminates script, and returns the value of N, if N is not specified
returns 0

*PASS Immediately terminates script, and returns 0 (pass)

*FAIL Immediately fails script, and returns 1 (fail), unless *NOFAIL is set, then script
will run to completion, and return 1

Script will run to completion, and returns 1, if failure occurred during execution,
or 0, if pass (it is a sticky flag, and can not be unset)

Configuration directive which sets the shell immediately after automatic login to
remote host (see setting the shell)

A breakpoint which places user in interact mode, and pauses the script and turns
control of the keyboard over to the user

Once set, will ignore all succeeding breakpoints (*INTERACT). This permits running
a script or scripts in an unattended regression. This can not be unset (it is a
sticky flag)

*FORK <session>
Multiple session support. Directs expect-lite to open a new session and spawns a
new shell

Debug information, displays all expect-lite variables. Can be used in interact

Debug information, displays expect-lite environment, including state of directives,
infinite loop counter, log file name (if used), and environment variables. Can be
used in interact mode.

Infinite loop protection value, sets N as new value

Controls end of line sequence sent to remote host, either line feed, or carriage
return + line feed.

Enable/disable the Dynamic Variable capture method to require a trailing prompt

Once set, will ignore all succeeding include files (lines starting with ~). This
was the default behaviour in Library mode (introduced in v4.1). This behaviour is
no longer default, and this directive provides a method to previous behavior.

Logging encompasses two operations: 1) writing script output to a file, 2) controlling
additional messages, such as info, exp_info and warnings. All logging commands when used
on the CLI will override those inside the script

Enable/disable logging of standard out and messages to a file. The log file name
will be <script_name>.log saved in the script directory.(see Environment Variable
EL_LOG_EXT below)

*LOG <file_name>|*LOGAPPEND <file_name>
Enable logging to a user specified path/file_name. When invoked on the CLI, the
specified file_name must end in ".log" (or as defined by EL_LOG_EXT) to avoid

Enable/disable informational messages

Enable/disable "expected" messages (additionally use -V flag to enable)

Enable/disable warning messages

Enable/disable debug messages

Disables color on stdout

Prints Date and Timestamp with milisecond accuracy, for each command sent, ISO is
default. Timestamps will be written to log file when *LOG is used.

Disables timestamp printing

Environment Variables
It is no longer necessary to hand edit the expect-lite script itself. All parameters such
as connect_method, login name and password are controlled via shell environment variables.
This permits individual customization in a multi user environment. It is recommended to
save these values in .expect-literc and source it from .bashrc or .cshrc. If set, the
following environment variables will be used:

The method expect-lite uses to connect to remote host. Valid options are:
none|telnet|ssh|ssh_key Default is none

User name to use for login on remote host (telnet|ssh)

Password to use for login on remote host (telnet|ssh)

Infinite loop protection value, sets N to user's default value

Delay (in ms) to wait for host in Not Expect, and Dynamic Var Capture. 100 ms is a
good value for a local LAN, 200 ms if running across high speed internet

Name or IP of remote host

Name of expect-lite script to run

Change to this directory upon login before executing script

Start this shell (default bash) when using EL_CONNECT_METHOD=none

Set the Dynamic Variable capture method to require a prompt (default=1). Disable by
setting to 0.

Set the log file name extension string (default=".log") which is appended to the
script name when using *LOG without file name argument or used to detect a log file
name on the command line.

EL_* Any other shell environment variables starting with EL_ will become constants

Debugger (IDE)
The debugger performs three primary functions: 1) connecting the user to the remote host
or device under test, 2) monitoring special commands prefaced with the escape key for
stepping, and other functions, and 3) the debugger will allow expect-lite script lines to
be executed by either typing directly or pasting them into the IDE.

The debugger is invoked at a breakpoint by placing the *INTERACT command in the script, or
using by instant-interact at anytime during the script execution by pressing
ctrl+backslash ^\

<esc>s Step, execute next step in script

<esc>k sKip next step in script

<esc>c Continue execution of the script

<esc>v show Vars, display expect-lite variables and values

<esc>e show Environment, display expect-lite environment

display next N lines of script

display last N lines of script

ctrl+d Quit & Exit expect-lite

<esc>h display Help

[pasted line(s)]
execute any pasted line(s) from a script into the IDE

[type any expect-lite line]
execute any typed expect-lite script line

Use expect-lite online using onworks.net services

Free Servers & Workstations

Download Windows & Linux apps

  • 1
    itop - ITSM  CMDB OpenSource
    itop - ITSM CMDB OpenSource
    IT Operations Portal: a complete open
    source, ITIL, web based service
    management tool including a fully
    customizable CMDB, a helpdesk system and
    a document man...
    Download itop - ITSM CMDB OpenSource
  • 2
    Clementine is a multi-platform music
    player and library organizer inspired by
    Amarok 1.4. It has a fast and
    easy-to-use interface, and allows you to
    search and ...
    Download Clementine
  • 3
    ATTENTION: Cumulative update 2.4.3 has
    been released!! The update works for any
    previous 2.x.x version. If upgrading
    from version v1.x.x, please download and
    Download XISMuS
  • 4
    Modular headtracking program that
    supports multiple face-trackers, filters
    and game-protocols. Among the trackers
    are the SM FaceAPI, AIC Inertial Head
    Tracker ...
    Download facetracknoir
  • 5
    PHP QR Code
    PHP QR Code
    PHP QR Code is open source (LGPL)
    library for generating QR Code,
    2-dimensional barcode. Based on
    libqrencode C library, provides API for
    creating QR Code barc...
    Download PHP QR Code
  • 6
    Cuckoo Sandbox
    Cuckoo Sandbox
    Cuckoo Sandbox uses components to
    monitor the behavior of malware in a
    Sandbox environment; isolated from the
    rest of the system. It offers automated
    analysis o...
    Download Cuckoo Sandbox
  • 7
    Play YouTube video on LMS (porting of
    Triode's to YouTbe API v3) This is
    an application that can also be fetched
    Download LMS-YouTube
  • More »

Linux commands

  • 1
    2vcard - convert addressbooks to VCARD
    format ...
    Run 2vcard
  • 2
    xml2 - convert xml documents in a flat
    format 2xml - convert flat format into
    xml html2 - convert html documents in a
    flat format 2html - convert flat format
    Run 2xml
  • 3
    cpupower - Shows and sets processor
    power related values ...
    Run cpupower
  • 4
    CQRLOG - Advanced logging program for
    hamradio operators DESCRIPTION: CQRLOG
    is an advanced ham radio logger based on
    MySQL database. Provides radio control
    Run cqrlog
  • 5
    gammu-smsd - SMS daemon for Gammu ...
    Run gammu-smsd
  • 6
    gammu - Does some neat things with your
    cellular phone or modem. ...
    Run gammu
  • More »