#!/usr/bin/env bash
# make this auto-runnable! 
# Little bootstrap bash script to run kick start expect-lite script
# determine OS (Mac, Linux, cygwin)
OS=`uname -s`
HOST=localhost
case $OS in
	"Linux" )       SED_OPT=" -r ";;
	"Darwin" )      SED_OPT=" -E ";;
	"CYGWIN_NT-5.1" )   HOST=none;   
						SED_OPT=" -r ";;
	* )				echo "Error: Unknown OS:$OS"
					exit 1;;
esac
# Convert --parms to expect-lite param=value format
PARAMS=`echo $* | /bin/sed $SED_OPT 's;--([a-zA-Z]+) ([0-9a-zA-Z]+);\1=\2;g'`
echo $PARAMS
#$HOME/bin/expect-lite r=$HOST c=$0 $PARAMS
$HOME/Expect-lite/2expect-lite r=$HOST c=$0 $PARAMS
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
# For more info see: http://lancelot.am.freescale.net/~craig/Docs/expect-lite.html

#
#	test of Dynamic Var
#

#~mod_common.inc

$manarch=i386

# set timeout value to 5 seconds
; ==== Set Timeout ====
@3
>id
<craig|cmiller|cvmiller

$tmp=/proj/regression/tmp/generalRegression/tc_gzip_reserve.elt/
$junk=orbit-root
$junk2=$junk/some/path

> cd $tmp
> pwd


>if  [ $manarch = i386 ]; then  
>echo "test_include.txt"
>else 
>echo "ppc" 
>fi

*INFINITE_LOOP 10
>echo hello
*INFINITE_LOOP abc

>sleep 2
*INTERACT

> echo hello
?if 1 == 1 ? %PAU
!puts "here"
!puts "there\n"

>> pwd
+$P=\n/home/([a-z]+)

>echo "test_include.txt"
+$INCLUDE=\n([0-9a-zA-Z\._]+)

#~$INCLUDE
~test_include.txt

%PAU
>echo "Returned from include file"
-<Return
<file
>echo "[test]"
<<[test]

>echo tfile_$RANDOM
+$temp_file=\n(tfile_[0-9]+)

*INTERACT
>
#pau
