3

我想把这个

#!/usr/bin/expect
spawn ssh-copy-id -i .ssh/id_dsa.pub root@testip
expect "Are you sure you want to continue connecting (yes/no)?"
send -- "yes\r"
expect eof

我认为应该是

/usr/bin/expect -c 'expect "\n" { eval spawn ssh-copy-id -i .ssh/id_dsa.pub root@testip; expect "Are you sure you want to continue connecting (yes/no)?"; send -- "yes\r" }'

但事实并非如此。

谁能看到它应该是怎样的?

4

1 回答 1

4

也许你不再需要它了,但它应该是这样的:

/usr/bin/expect -c 'spawn ssh-copy-id -i .ssh/id_dsa.pub root@testip ; expect "Are you sure you want to continue connecting (yes/no)?" ; send -- "yes\r" ; expect eof'
于 2012-10-25T20:01:29.000 回答