bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Interactive Expect from bash Script


From: Esben Stien
Subject: Re: Interactive Expect from bash Script
Date: Sat, 29 Mar 2014 21:32:08 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Andreas Schwab <schwab@linux-m68k.org> writes:

> Please define "outside the bash script".

If I run this, it works: 

#!/usr/bin/expect

set passwd [lindex $argv 1]
set password passwd
spawn /usr/bin/ssh [lindex $argv 0]@[lindex $argv 2]
expect {
    -re ".*Are.*.*yes.*no.*" {
        send "yes\n"
        exp_continue
        #look for the password prompt
    }

    "*?assword:*" {
        send $passwd
        send "\n"
        interact
        #The expect command will now return
    }
}


> Since you are passing the expect script on stdin the interact command
> will immediately read EOF, and expect will run into its implicit
> timeout.

Hmm, I see, so how am I supposed to run it?;)

-- 
Esben Stien is b0ef@e     s      a             
         http://www. s     t    n m
          irc://irc.  b  -  i  .   e/%23contact
           sip:b0ef@   e     e 
           jid:b0ef@    n     n



reply via email to

[Prev in Thread] Current Thread [Next in Thread]