Re: [Expect] Need to have explanations for the use of the expect command



At 2006-03-15 11:42AM, Andrew Falanga <not_real@xxxxxx> wrote:
#! /usr/bin/expect

set host [lindex $argv 0]

Try adding here:
exp_internal 1

spawn ssh root@$host "cd logs; ls"

expect {
-re password { sleep 1; exp_send "password\r" }
}

Actually, that's not just basically the script, it is the script. As
far as I can tell, this isn't working. The script does spawn the ssh
process, but when the prompt comes for root's password, it just sits
there for 5 or 10 seconds and then, apparently, times out.

There will be copious output, but look for something like:
did <big long string> match 'password'? no

You may not be expecting the right thing.

--
Glenn Jackman
Ulterior Designer
.



Relevant Pages

  • Re: Customizing the python search path depending on source directory
    ... > just happens that the main script is in the current directory. ... except AttributeError: ...
    (comp.lang.python)
  • Help with expect
    ... having an issue with this particular script that I just cannot seem to ... set user [lindex $argv 0] ... timeout ...
    (comp.lang.tcl)
  • expect script to ssh to server, login as root, run commands
    ... I'm using the expect script below to be called from a ksh script and ... commands being run as root succeed or not, but wasn't sure how to trap ... set SERVER [lindex $argv 0] ...
    (comp.lang.tcl)
  • Help with expect script
    ... I have an expect script that logs into a host and updates some OS ... I have the telnet portion ... set Receiver [lindex $argv 0]; ...
    (comp.lang.tcl)
  • Help with expect script
    ... I have an expect script that logs into a host and updates some OS ... I have the telnet portion ... set Receiver [lindex $argv 0]; ...
    (comp.unix.shell)