Esben Stien writes:
> # _run=`/usr/bin/expect<<'EOF'
> /usr/bin/expect<<'EOF'
> set passwd $env(_passwd)
> set usr $env(_usr)
> set host $env(_host)
You never set these variables.
Andreas.
--
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B
Andreas Schwab writes:
> Esben Stien writes:
>> set passwd $env(_passwd)
>> set usr $env(_usr)
>> set host $env(_host)
> You never set these variables.
Right, sorry, I had them in my environment. I've set them now, but it
doesn't make any difference.
--
Esben Stien is b0ef@e s a
Mike Frysinger writes:
> you could accomplish all of this with python alone. are you aware of
> the pexepct module ? http://pexpect.sourceforge.net/
The implementation below is in python using pexepect and it works
fine. It still doesn't answer the question why this doesn't work in bash?
> if
Esben Stien writes:
> The expect code works fine when executed outside the bash script,
Please define "outside the bash script". Since you are passing the
expect script on stdin the interact command will immediately read EOF,
and expect will run into its implicit timeout.
Andreas.
--
Andreas
Andreas Schwab 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
Esben Stien wrote:
> export _csv=`python <<'END'
As you have already discovered this is the source of your problem.
> /usr/bin/expect<<'EOF'
Times two, nested.
The bash documentation says:
Here Documents
This type of redirection instructs the shell to read input from
the curre
Esben Stien writes:
> Hmm, I see, so how am I supposed to run it?;)
As above.
Andreas.
--
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
Bob Proulx writes:
>> spawn /usr/bin/ssh $usr@$host
>
> The above will then always get EOF from the here-document file which
> has already been read to the end of file.
Wrong. The spawned process is connected to the expect process via a
pty, and will read whatever the latter sends to it.
Andre
Esben Stien wrote:
> If I run this, it works:
>
> #!/usr/bin/expect
Sounds good. Is there anything particular bad about running it as an
expect script? (Or in native python using pexepect? Or in native perl
using Perl's expect library? Or Ruby's?)
> Andreas Schwab writes:
> > Since you are
Bob Proulx writes:
> #!/bin/bash
expect -c '...' "$_usr" "$_host" "$_passwd"
RTFM?
Andreas.
--
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
Andreas Schwab wrote:
> Bob Proulx writes:
>
> > #!/bin/bash
> expect -c '...' "$_usr" "$_host" "$_passwd"
Of course that works too. Why were you so late to share this wisdom?
> RTFM?
It has probably been more than fifteen years since I have done any
significant work with expect. And in the
11 matches
Mail list logo