| |||
Expect script that gets into loop Posted by manisri (manisri), 21 March 2003 Hi, i am running the below script under WindowsNT. Here "ds" expects from user.(i want to make it non-interactice using script). But following script goes into loop even i am giving input("dsreddy") only once . plz help me why it is going into loop.? exp_internal 1 set exp_nt_debug 1 set timeout 60 spawn ds while 1 { expect { "dsreddy" { #puts "$expect_out(0,string)" set str $expect_out(0,string) send "$str\r" } "msreddy" { send "Good one\r"} eof exit } } Posted by admin (Graham Ellis), 21 March 2003 You're going into the loop because it's there in your code and will always be reached, and the condition you give ("1") is always true.Are you telling us that it remains in the loop (i.e. keeps looping) when you don't expect it to? The ds program that you have spawned starts off by sending us the string "dsreddy" which you ECHO RIGHT BACK TO IT. Perhaps this is right, but it seems a bit peculiar - I might guess that you want to puts (to stdout) rather than send (to ds) the string. This page is a thread posted to the opentalk forum
at www.opentalk.org.uk and
archived here for reference. To jump to the archive index please
follow this link.
| |||
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho |