Wednesday, May 16, 2007

Expect - Automation era

In this section I will be showing how to automate interactive sessions with "expect"

Beginning with a very simple example. Suppose you have a very simple script like this.

$ cat
echo "Whats your name"
read name
echo "Hello $name"

Here is expect script "test.exp" to automate the above script

#!/usr/bin/expect -f

spawn ./

expect "Whats your name"
send "RAJA\r"

$ expect test.exp
spawn ./
Whats your name
Hello RAJA

Note:: I will be adding a detailed page for expect very soon here.

No comments:

© Jadu Saikia