
ssandela
New User
Jul 29, 2010, 10:17 PM
Post #1 of 1
(3064 views)
|
Automating Password entry(involving git)
|
Can't Post
|
|
Hi, I am trying to use expect to automate the password entry process with git pull. I am able to understand and use expect.pm and verified it on "ssh -l server" command, but when i replace the command with "git pull" the script doesnt work. Following is the script am using and the error i get. CODE: use Expect; use strict; my $exp = Expect->new(); $exp->debug(3); $exp->exp_internal(1); $exp->spawn("git pull"); if($exp->expect(1, '-re', '.*?password.*')) { $exp->send("!w^\$e*\r"); $exp->send("ls -al > /tmp/ls.txt\r"); } else { warn("inside else\n"); } $exp->soft_close(); Error: After spawning the command, the control always enters in to else part. I tried with different regular expression patterns but it never works.. I have even tried with regular expression of ".*+.*", in this case the if part got executed but the "send" is not able to do its job. Can somebody please help me 1)Understand why is the problem with git. 2)any other way of automating the password entry in perl using any other mechanis. Thanks in anticipation.
|