1

Expect scripting telnet stop on bad username or password

view story
linux-howto

http://www.unix.com – I am trying to build and expect script to log into multiple aix boxes and change password. I need for the script to terminate if it cannot log into a server because the username or password is wrong. #!/usr/bin/expect set timeout 1 set host [lindex $argv 0] set user [lindex $argv 1] set password [lindex $argv 2] set uh "Unknown host" set ivl "\[compat\]\: You entered an invalid login name or password" set lg "login" set pwd "Password:" set prp "$host" proc login {user password} { expect "Login:" send "$user\r" expect &quot (HowTos)