Training, Open Source computer languages
PerlPHPPythonMySQLApache / TomcatTclRubyJavaC and C++LinuxCSS 
Search for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
 
20.9.2014 - We have just updated our course layouts and descriptions and added our 2015 schedule.

interact command not working

Posted by nikunj (nikunj), 25 May 2004
Hi,
I am new to the expect and to this forum too , and am
perplexed by an seemingly easy thing.
I have written an expect script and I want it to stop running till the user wants it to, and when user says ok, then it should  continue running.
I tried using interact command as in

spawn ssh2 root@$ipadd
expect "password:"
exp_send "$pwd\r"
expect "#"
puts "press enter when you want to continue"
interact "\r" { return }
expect "#"
##continue script

when i run this from command prompt,I get an error
invalid command name "interact "

Also I saw a statement on many sites
#!/usr/local/bin/expect -f
whose use i couldnt figure out .
Please help me out....
Thanks
Nikunj


Posted by admin (Graham Ellis), 25 May 2004
Hi, the #! line is used by the shell (the command line handler) on Unix and Linux systems) to tell the operating system which language the script file is in.   You do NOT need this line if you're running from the command line and typing "expect" or some alternative in front of the name of your expect script file.

OK ... that was the easy one to answer ...

If the interact command is missing, I wonder if you have some cutdown version of expect, or perhaps if you've got a control character edited somewhere into the name of the command in your script.   Just wild guesses.   Try to delete the whole interact line and retype it ... if that doesn't work, can you post up the version details and operating system of your expect in the hope it might give some clues.

Posted by nikunj (nikunj), 25 May 2004
Thnks for the prompt reply..

I am using  Expect-5.21. running the script from command propmt on Win 2k machine..

Is there any other way of doing this
, i.e waiting for the  user's nodd to continue with the script,without using TK??
(I dont know TK so can't pop up a message box, is it easy?)
can you send me a small code demonstrating "interact",
'coz amnt sure of the use I have made?
Thanks

Posted by admin (Graham Ellis), 25 May 2004
Expect is designed around Unix, ports well to Linux, and is a bit "iff-y" on Windows.  I suspect that the interact command isn't implemented in the version you have.   I have noticed a recent release of Expect for Windows at Activestate http://www.activestate.com and that might include Interact ... at very least, you could ask them.

By the way - if you accidentally post twice, you can delete your own (excess) post using the remove button.

Posted by nikunj (nikunj), 25 May 2004
Ok, will try to get the new version...
But In the meantime, isnt there any other way to
do the same thing, for eg by writing some
puts and expect command?
does expect command read whatever we write by using
puts?
Sorry to annoy you with innocent questions.
thanks



Posted by admin (Graham Ellis), 25 May 2004
We're here for these questions that look so easy but you just can't find the answers for - but don't always expect such a quick response.

I would suggest that you try to get a version with interact ... it might be possible to code something, but the reason that interact is provided is that there's no easy one or two line alternative ... and perhaps the reason it wasn't in the older windows version is that it was hard / impractical to implement?

Posted by nikunj (nikunj), 25 May 2004
Thanks ......
but this new version is not getting installed
after installing license, on running setup it says
"No installation of Tcl Dev Kit or ActiveTcl found.  "
and aborts it.....
Anyways........would try something else.......
thanks for your help.......
this forum is amazing....




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.

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2014: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 899360 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho