Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Problems with expect and scp

62 views
Skip to first unread message

Esa Heikkinen

unread,
Jun 13, 2007, 4:23:25 AM6/13/07
to
Hi

I have problems with expect (5.43) and scp (Cygwin) in Windows NT.
With ssh (Cygwin) there are no problems and it works very well.

If i give my scp-command (scp lo...@1.1.1.1:/home/login/log/* .) "by hand"
(in Cygwin), it works very well.
(login and IP-address has been changed.)

My script:
spawn scp lo...@1.1.1.1:/home/login/log/* .
expect "password:"
send "password\r"

Following error message was generated:
"write(spawn_id=1]: broken pipe"

Why ssh works with expect, but scp does not ?

---
Esa


Bezoar

unread,
Jun 21, 2007, 4:16:31 PM6/21/07
to
On Jun 13, 3:23 am, "Esa Heikkinen" <esa.heikki...@insta.fi> wrote:
> Hi
>
> I have problems with expect (5.43) and scp (Cygwin) in Windows NT.
> With ssh (Cygwin) there are no problems and it works very well.
>
> If i give my scp-command (scp l...@1.1.1.1:/home/login/log/* .) "by hand"

> (in Cygwin), it works very well.
> (login and IP-address has been changed.)
>
> My script:
> spawn scp l...@1.1.1.1:/home/login/* .

> expect "password:"
> send "password\r"
>
> Following error message was generated:
> "write(spawn_id=1]: broken pipe"
>
> Why ssh works with expect, but scp does not ?
>
> ---
> Esa

I know on my system that the shell will expand the * to a filename so
I have to get
the files like so
scp chuck@chimpy:/home/chuck/"*" .
this will prevent the scp from expanding the * to a file and screwing
up the command
Now when you do this in expect , tcl does not do shell expansion so
you are trying to
transfer a file named * not all files in the directory. Since it
cannot find file * it dies
you need to do this:

spawn scp l...@1.1.1.1:/home/login/log/\"\*\" .


Carl

esa.he...@insta.fi

unread,
Jun 25, 2007, 11:28:42 AM6/25/07
to
On 21 kesä, 23:16, Bezoar <cwjo...@gmail.com> wrote:
> On Jun 13, 3:23 am, "Esa Heikkinen" <esa.heikki...@insta.fi> wrote:
>
>
> spawnscpl...@1.1.1.1:/home/login/log/\"\*\" .
>
> Carl-

Hi

This does not work :(

Even if give command "spawn C:\\cygwin\\bin\\scp lo...@1.1.1.1:/home/
login/log/file.txt" this does not work.

Same error is occured.

---
Esa


0 new messages