5

Using expect

view full story
linux-howto

http://www.unix.com – Hello. I am trying to debug a script of mine. I am using the ssh-copy-id from a script run by root. Code: #!/bin/sh # $1 is user_name  $2 is computer adress spawn -noecho  ssh-copy-id $1@$2 ] set timeout 20 send_user "ssh-copy-id started\n" while {1} {     expect {         ^"(Password :)"$ {             sleep 1             expect_user -re "(.*)\n"             set the_password $expect_out(1,string)         &nb (HowTos)