Expect: getting out of control interact

December 2016


Expect: getting out of control interact




Issue


I use the interactive controls and expect I will like to get out without interference. I arrived with timeout but it bothers me because I could interrupt my program, I can not get him out in other ways such
Interact eventually return
Don't work!
my script to launch:
# / Usr / bin / expect spawn telnet asus02 expect "login:" send "Log \ r" expect "password:" send "pwd \ r" expect ">" send "echo I'll get into the swing \ r" expect ">" send "lancementRhino.bat \ r" expect ">" send "echo I left the beat \ r" interact timeout 100 return exit
And in lancementRhino.bat:
echo mybat running cd "C: \ My Path" dir Rhino4 / runscript = "-_exit" rapide.txt mybat echo finished

Solution

  • Have you tried to "set timeout -1"(and deleting" interact "):



# / Usr / bin / expect
set timeout -1
spawn telnet asus02 expect "login:" send "Log \ r" expect "password:" send "pwd \ r" expect ">" send "echo I'll get into the swing \ r "expect"> "send" lancementRhino.bat \ r "expect"> "send" echo I left the beat \ r "exit

Related :

This document entitled « Expect: getting out of control interact » from CCM (ccm.net) is made available under the Creative Commons license. You can copy, modify copies of this page, under the conditions stipulated by the license, as this note appears clearly.