http://qs321.pair.com?node_id=89741

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.