Re: [Expect] Need to have explanations for the use of the expectcommand
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.tcl archive

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

From: Russell Treleaven <russ@else.net>
Date: Thu Mar 16 2006 - 02:27:23 CET

Andrew Falanga wrote:

> Andrew Falanga wrote:
>>>^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> Forgot to mention that I figure this is because the expect program has
> redirected stdin, stdout and stderr internally.
>

The following script works for me (I see the output of ls)
The reason it doesn't work for you is because your script terminates before
you can see the output because you don't have the final expect
--------------------------------------------------------------
#!/usr/bin/tclsh

package require Expect
set timeout 60
set user "xxxxxx"
set host "xxxxxx"
set password "xxxxxx"
spawn ssh $user@$host "cd /home/xxxxxx; ls"
expect -ex "Password: "
exp_send "$password\r"
expect "$ "
Received on Sun Apr 30 02:34:36 2006