Expect task

Expect task

Description

Task to process expect, a program to automate interactions with programs that expose a text terminal interface.

Installation

$ apt-get install expect

Expect task parameters

Element Description Value Required
inner element script content <![CDATA[…]]> yes

Examples

<project name="expect task">
	<taskdef name="expect"
		classname="net.sourceforge.ant4x.taskdefs.linux.ExpectTask"
		classpath="PATH/TO/ant4x.jar"/>
	
	<target name="compile" description="compile src on a remote server">
		<expect><![CDATA[
#!/usr/bin/expect
spawn telnet <ip>

expect {*Enter terminal type :}
send "<term>\r"
expect {*login:}
send "<user>\r"
expect {*$ }

send "cd /path/to/my/project\r"
expect {*$ }

send "./bin/compile.sh\r"
] ]>			
		</expect>		
	</target>
</project>