Expect Example

Here is a very simple script illustrating the use of expect:

#!/usr/bin/expect -f
log_user 0
set server [lrange $argv 0 0]
set from [lrange $argv 1 1]
set to [lrange $argv 2 2]
set message [lrange $argv 3 end]
spawn telnet "$server" 25
send "EHLO me\r"
set timeout 30
send "MAIL FROM: $from\r"
send "RCPT TO: $to\r"
send "DATA\r"
send "$message\r"
send ".\r"
send "QUIT\r"
expect oef

Comments

This is a great summary for

This is a great summary for the codes. I have visited other sites and they seem to be disorganized unlike this one. - Roger Quick

Microot Microwave specializes

Microot Microwave specializes in the design and manufacture of broadband RF Microwave components since 2003. Our extensive product line includes power divider, directional coupler, Hybrid coupler, Low Noise Amplifier, Frequency Source and more.

About Consultancy Articles Contact




References Red Hat Certified Architect By Robert de Bock Robert de Bock
Curriculum Vitae By Fred Clausen +31 6 14 39 58 72
By Nelson Manning [email protected]