1

I created the following expect script in order to automate logging into a VPN:

 #!/usr/bin/expect

 set PASS [lindex $argv 0]

 set timeout 10
 spawn  vpnc
 expect    :            {send $PASS\r}
 expect eof

However, when I give wrong password argument, the expected 10 second does not occur.

Why does this 10 second timeout not occur?

1 Answers1

1

I would explicitly expect the timeout:

set timeout 10
spawn  vpnc
expect :
send [lindex $argv 0]\r
expect {
    timeout {error "incorrect password"; exit 1}
    eof
}
glenn jackman
  • 25,463
  • 6
  • 46
  • 69