expect-lite

Langue: en

Version: July 2010 (ubuntu - 24/10/10)

Section: 1 (Commandes utilisateur)

NAME

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

SYNOPSIS

expect-lite [-vv] -c <script> [-r <host>] [CONSTANT=value]
or
expect-lite [-vv] c=<script> [r=<host>] [CONSTANT=value]

DESCRIPTION

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]

or short form: expect-lite r=<remote_host_IP> c=<command_file> [d=<user_dir>] [const1=value1] eg. ./expect-lite r=host-008 c=pm_alternation.elt d=/local/craig/SW_6_Mar/sw myvar=myvalue

additional login options: user_name=<username> user_password=<password>
eg. ./expect-lite r=host-008 c=pm_alternation.elt u=superuser p=mysecret
additional debug options: -v|-vv|--verbose
-v
prints warnings, and infos (i.e. conditionals, dynamic var assignments)
-vv|--verbose
prints warnings and debug (i.e. expect match info)
eg. ./expect-lite -v r=host-008 c=pm_alternation.elt

If set, the following environment variables will be used:


EL_REMOTE_HOST
EL_CMD_FILE
EL_USER_DIR
EL_*

COMMAND SYNOPSIS

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 fuller 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 alloted 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!
#
used to indicate comment lines, and have no effect
;
are also used to indicate comment lines, but are printed to stdout (for logging)
;;
similar to above, but no extra newlines are printed (useful for printing script help)
@num
changes the expect timeout to num of seconds
$var=
static variable assignment at script invocation
+$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)
!
indicates an embedded expect line
?
c-style if/then/else in the format ?cond?action::else_action
%
label - used for jumping to labels
~filename
includes a expect-lite automation file, useful for creation of common variable files, or 'subprograms/subroutines'

Directives

*~filename
Include a fail script, which expect-lite runs only if the main script fails
*/prompt/
Set a user defined prompt (defined in regex)
*TERM
Immediately terminates script, but returns 0 (pass)
*FAIL
Immediately fails script, and returns 1 (fail)
**SHELL=<shell>
Configuration directive which sets the shell imediately after automatic login to remote host (see setting the shell)
*INTERACT
A breakpoint which places user in interact mode, and pauses the script and turns control of the keyboard over to the user
*FORK <session>
Multiple session support. Directs expect-lite to open a new session and spawns a newshell
*SHOW VARS
Debug information, displays all expect-lite variables. Can be used in interact mode.
*EOLS LF|*EOLS CRLF
Controls end of line sequence sent to remote host, either line feed, or carriage return + line feed.

Logging

*INFO|*NOINFO
Enable/disable informational messages
*WARN|*NOWARN
Enable/disable warning messages
*DEBUG|*NODEBUG
Enable/disable debug messages
*NOCOLOR
Disables color on stdout

AUTHOR

Written by Craig Miller

REPORTING BUGS

Report bugs to <cvmiller at gmail dot com>. Copyright © 2007-2010 FreeScale Semiconductor and Craig Miller
License BSD-Style: This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.

SEE ALSO

The full documentation for expect-lite is maintained as an HTML manual. Please see http://expect-lite.sf.net/ for complete documentation.