I have the following expect script:
#!/usr/bin/expect
set timeout 20
set cmd "/path/vpntool --server 1.2.3.4:443 --vpnuser user"
set password [lindex $argv 0]
eval spawn $cmd
expect "VPN:"
send "$password\r";
interact
expect ".*\(Y\/N\)"
send "Y\r";
interact
The scripts stops at the question "Would you like to connect to this server? (Y/N)" waits for the answer.
Does anybody know what could be the problem?
/. Is that the cause? OR maybe you need to sendY\n. – ctrl-alt-delor Feb 07 '19 at 12:05interactbefore your secondexpectcommand? That interact doesn't have a return condition, so theexpect ".*\(Y\/N\)"is never reached... Also: the/character isn't special to regular expressions and doesn't need to be escaped, and the.*at the beginning of the expect pattern is extraneous. – This isn't my real name Feb 07 '19 at 17:00