Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

How do I have Perl send the password to a program that prompts for a password

by turumkhan (Novice)
on Jun 19, 2001 at 21:36 UTC ( [id://89741]=perlquestion: print w/replies, xml ) Need Help??

turumkhan has asked for the wisdom of the Perl Monks concerning the following question:

I have to run a command in my perl script by using the back ticks. when i execute that command it asks me for password. Now i wanna pass that password without typing it. for clear understanding of the problem here it goes:
`run the command line`;
now it asks me for password. What i want to do is capture is prompt and pass the password in the script itself rather then typing it all the times. So how do i caputre when the output when it prompts me for the password.

Originally posted as a Categorized Question.

  • Comment on How do I have Perl send the password to a program that prompts for a password
  • Download Code

Replies are listed 'Best First'.
Re: how do i redirect the output to a var
by dragonchild (Archbishop) on Jun 19, 2001 at 21:40 UTC
    Instead of using backtick, try using either system or opening the command as a pipe. Both of those should allow for greater control than backtick.
Re: how do i redirect the output to a var
by runrig (Abbot) on Jun 19, 2001 at 22:21 UTC
Re: How do I have Perl send the password to a program that prompts for a password
by ton (Friar) on Jun 21, 2001 at 02:31 UTC
      Or, you can try Expect.pm.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://89741]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (5)
As of 2024-04-19 16:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found