The title is similar to unable to spawn ssh using TCL expect in ActiveTCL but I think I'm running into a different problem...
I just installed the 32-bit version of ActiveTcl 8.5 on my Windows 10 PC. After installing it, I successfully installed Expect by typing the following at the tcl command line:
teacup install Expect
While following a tutorial on how to use Expect to log into a remote machine, my code is failing when it tries to use the 'spawn' command. I have reduced my code down to the following minimum lines in a script file called simple_ssh.tcl
#!/bin/sh
# \
exec tclsh "$0" ${1+"$@"}
package require Expect
spawn ssh [email protected]
expect "[email protected]'s password:"
When I run this with the command tclsh simple_ssh.tcl
, I get the error:
The request is not supported. while executing "spawn ssh [email protected]" (file "simple_ssh.tcl" line 5) child process exited abnormally
If I instead simply type ssh [email protected]
at the tcl prompt, the remote machine responds with the expected prompt:
[email protected]'s password:
And the ssh session operates as expected. So it can see the ssh process. It seems to me that 'spawn' might not be properly integrated into Expect. What else could I be doing wrong? Is there another package I need to install as part of ActiveTcl to get this to work?
Try: spawn "ssh [email protected]"