greater than

expect-lite


Automation for the rest of us


What is it?

expect-lite is an quick and easy command line automation tool.

Written in expect, it is designed to directly map an interactive terminal session into an automation script. expect-lite scripts use special 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. No knowledge of expect is required!

The main purpose is keep it simple. However, the advanced features allow pretty creative scripting.

What is New since Linux Symposium 2010?

The new features include:

  • Color (3.7)
    • *EXP_INFO - displays expected value found
  • IDE (4.0)
    • Powerful Debugger with breakpoints, step/skip, copy/paste expect-lite lines right into a running script.
    • *TIMESTAMP > commands
  • Library Release (4.1)
    • use expect-lite as a TCL library
  • Code blocks (4.2)
    • While Loop
    • Multi-line if statements
    • Full IPv6 support
  • User Defined help (4.3)
    • Making your script more user friendly
    • Include file improvements - simple regression
      • *NOINTERACT - does not stop at breakpoints
  • Native Logging (4.4)
    • Log everything to a file, natively
    • *LOG *NOLOG
  • Code blocks - else statement (4.5)
    • Foreach Loops with code blocks (4.6)
    • String Math: search/replace, concat, remove
  • Fuzzy Expect (4.7)
    • Expect an approximate value e.g. 11 is about 10
New features since 2014 Linux Symposium presentation
  • IDE Improvements (4.8)
    • Show Environment - *SHOW ENV displays internal flags and counters e.g. *INFINITE_LOOP
    • Added unset variable e.g. $var=
    • Added ability to exit with different exit code e.g. *TERM 3
  • Native Sleep (4.9)
    • Supports mili-second sleep, and displays progress counter to make sleeping more transparent while monitoring script execution
    • Added progress display on expect lines e.g. < << ~<

Download the Linux Symposium Presentations 

The Linux Symposium Presentations are in PDF format:

Where to get it?

The most recent version is always available on SourceForge:

Download the latest version

Also expect-lite is even easier to install as part of the following distributions:

Examples

Check the IP address of the localhost

>ifconfig
<192\.168\.1\.1
>ip -6 addr show
<2001:db8::f00d

ssh to a remote host

>ssh root@host-021
<assword:
>>secret_password
# issue a command once logged in
>ls
>exit
While loops using code blocks
$i=1
[ $i < 5
>echo hello times $i
<times $i
+$i
]
Conditional using code blocks
? $IP == 2001:db8::f00d ? [
>echo future of the internet is here
]::[
>echo time to upgrade to IPv6
]

expect-lite includes over 25 example scripts covering topics such as: if statements, looping, multiple sessions, random number generation, and more.



15 Oct 2016
http://expect-lite.sourceforge.net/

this document for version 4.7 and above