Archive

Posts Tagged ‘expect’

Автоматизация работы с помощью Expect

July 6th, 2009 No comments

Expect is a program that performs programmed dialogue with other
interactive programs. It is briefly described by its man page, expect(1).

It uses pseudo-tty’s to control the child processes, so it is not affected
by programs that refuse to read from stdin or pipes. (eg: passwd(1) etc).

WWW: http://expect.nist.gov/
FAQ: http://expect.nist.gov/FAQ.html

Установка:

$ portinstall expect

Пример скрипта:

#!/usr/local/bin/expect -f
set host case.net.ru
 
spawn telnet "$host" 25
expect "220 case.net.ru ESMTP Postfix"
send "EHLO localhost\r"
expect "250-case.net.ru"
send "AUTH PLAIN AHRUAMTIzNDU2\r"
expect "235 2.7.0 Authentication successful"
send "QUIT\r"
interact

Ссылки:

Tags: