0

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 eric@192.168.1.191
expect "eric@192.168.1.191'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 eric@192.168.1.191" (file "simple_ssh.tcl" line 5) child process exited abnormally

If I instead simply type ssh eric@192.168.1.191 at the tcl prompt, the remote machine responds with the expected prompt:

eric@192.168.1.191'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?

gboy
  • 633
  • 1
  • 6
  • 13

1 Answers1

0

Try: spawn "ssh eric@192.168.1.191"

tommy
  • 1