expect-lite at the Linux Symposium
Author: Craig Miller
Description: Automation for the rest of us
Keywords: test testing automation expec-lite script expect project google linux symposium ols

# 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 ## Download the Linux Symposium Presentations The Linux Symposium Presentations are in PDF format: 2010 - Introducing expect-lite 2014 - A quick look four years later ## 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: Ubuntu Linux Mint Gentoo ## 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.

14 July 2014
http://expect-lite.sourceforge.net/
this document for version 4.7 and above