Re: [Hampshire] embedded expect

Top Page

Reply to this message
Author: Simon Reap
Date:  
To: hampshire
Subject: Re: [Hampshire] embedded expect
Damian Brasher wrote:
> I used a combination of:
>
> . .config.sh
> ./expect << EOF
>    spawn scp expect $USER_ACC@$IP_ADD_A:expect
>    expect "assword:"
>    send -- "$USER_PASS\r"
>    expect eof
> EOF

>
> and...
>
> . .config.sh
> ./expect << EOF
>    spawn scp .ssh/local.key diap@$IP_ADD_C:key_from_a
>    expect "(yes/no)?"
>    sleep 0.2
>    send -- "yes\r"
>    expect "assword:"
>    send -- "$USER_PASS\r"
>    expect eof
> EOF

>
> Where I expected (no pun intended) the host to be authenticated, (yes/no)?
> etc

Tha't s the benefit of the "while" loop version - if you get the
"yes/no" prompt, it answers it, if you don't it doesn't matter, it will
just answer the prompts you *do* get. The above linear scripts will
have to time out waiting for the "yes/no" if you are already
authenticated, slowing things down a bit (and sending a superfluous
"yes" back, which may confuse the next password prompt)..

As you say, it's not really Voodo, just almost indistinguishable!

Simon