[macosx-unix] expect trouble
Jesse Callaway
bonsaime at gmail.com
Fri Jan 4 18:02:26 EST 2008
Hey all,
I've never really played around with expect, so I'm not sure if it's
problems with the osx pty and expect, or just me. Anyway I'm trying to
run a bunch of scripts while typing in my password only once. Some say
an agent would best serve me, but I just want to learn to use expect
properly anyway.
Here's my script:
#!/usr/bin/expect -f
send_user "RSA key passphrase: "
stty -echo
expect_user -re "(.*)\n" {set PASS $expect_out(1,string)}
send_user "\n"
stty echo
spawn rsync -aqz jesse at server.com:/etc /Users/jesse/Documents/Server\
Backups\ and\ Configs/server.com/
expect "id_rsa': "
send_user "\n"
send "$PASS\r"
When I run the script I get the prompt to enter the passphrase, then
it spawns the rsync job. I can see rsync and ssh spawn in top. Then I
see a prompt on my terminal to "Enter passphrase for key
'/Users/jesse/.ssh/id_rsa':" And everything quits immediately.
Do I need to be looking at stderr? Should I try yax? Should I try one
of python or perl expect modules?
-jesse
More information about the macosx-unix
mailing list