Expect
From Devpit
Expect is a Tcl based language that is often used to automate command line applications.
#!/usr/local/bin/expect -f # Example exec program that logs into an anonymous ftp server set timeout 10 ;# 10 seconds is default spawn /usr/bin/ftp $argv expect "Name" send "anonymous\n" expect "Password:" send "blah@example.com\n" interact