Lofland bLOG

Expect

Filed under Unix Notes on Tuesday, March 20th, 2007 @ 9:56am by Christen

Expect is really cool, and you can use autoexpect to MAKE an expect script from a session, like a macro recorder!
http://www.linuxjournal.com/article/3065
http://www.oreilly.com/catalog/expect/chapter/ch03.html
Here is my script to just telnet to port 25 to see the Sendmail version:

set timeout 10
spawn telnet $argv 25
match_max 100000
expect -exact “sendmail”
send — “quit\r”
expect eof

It was made with autoexpect and then edited, there is some more stuff in the file autoexpect spit out.
Here is how I loop it:
for i in $(cat MissingList);do echo $i >> output;test2.exp $i | grep -i sendmail >> output;done;cat output

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

Powered by WordPress