#!/usr/bin/env bash
# make this auto-runnable! 
# Little bootstrap bash script to run kick start expect-lite script
# Convert --parms to expect-lite param=value format
PARAMS=`echo $* | /bin/sed -r 's;--([a-z_]+) ([0-9a-zA-Z]+);\1=\2;g'`
echo "PARMS=$PARAMS"
expect-lite r=localhost c=$0 el=expect-lite test_host=none $PARAMS d=$PWD
exit $?
# How to use this expect-lite file, Lines that begin with:
#	'>' send to remote host, implies "wait for prompt"
#	'<' _MUST_ be received from the remote host, or this config script will fail
#	# are comment lines, and have no effect
#	; are printable (in stdout) comments, and have no other effect
#	@ change the expect timeout value
#	! Embedded Expect commands
#	? If statement, use format ?cond?action::else_action
# For more info see: expect-lite.html

#
# Self Self Test of Expect-lite Directives
#
#	Run as executable, not within expect-lite
#
#	Runs another expect-lite self test, and monitors INFO & WARNings
#	
#	Requires ssh connection, timing issues with remote_host=none
#
#	Requires expect-lite version 3.5.0
#

# default expect-lite app

# force use of Localhost (rather than none)
$LOCALHOST=localhost

@10
>$el r=$LOCALHOST c=self_test_directives.txt el=$el 
<expect-lite directive: Shell is: tcsh
<expect-lite directive: \*NODEBUG
<expect-lite directive: \*WARN
<If: expr { "hello" != "hello" } |then   >echo FAIL|else  >echo Good|result0
<expect-lite directive: \*EOLS CRLF 
<expect-lite directive: \*EOLS LF
<expect-lite directive: \*NOFAIL

# test fail script
<Fail Include Script: self_test_fail_script.txt
<FAILED COMMAND:echo "hello"
<Expect Failed:fail this
<Including Fail Script: self_test_fail_script.txt

<expect-lite directive: \*NOINFO
-<If: expr
<expect-lite directive: \*NOWARN
<sleep 2
-<Warning
<expect-lite directive: \*WARN
<Warning:Prompt Timed Out!
<Check timeout error
<WARN: Bad Timeout Value: two

<expect-lite directive: \*LOG
<expect-lite directive: \*NOLOG
<expect-lite: Appending to log file
<expect-lite directive: \*LOG
<expect-lite directive: \*NOLOG

<expect-lite: ERROR: couldn't open

<Overall Result
# test over check status
>echo $?
<\n1
; *********** Expect-lite Directive Test Pass! ************
>
