问题
I want to pass a password through a Perl script. I am basically writing a script to execute commands on Linux terminal.
At a particular commands execution, I get a prompt for
Password :← (I need to enter password here through my script)
But, my script just stops working.
After browsing, I found Expect
but I get an error saying: Can't locate Expect.pm in @INC (@INC contains: C:/Perl/site/lib C:/Perl/lib .)
I have not used Expect
before so have no clue what do I need to install.
回答1:
Expect.pm should work on Windows with latest Cygwin.
If I am correct you could install expect with PPM. However, it seems to me that it may not work: http://code.activestate.com/ppm/Expect/
It looks like IO-Tty fails to install on Windows. It should work on Cygwin.
来源:https://stackoverflow.com/questions/11236307/login-on-password-prompt-in-linux-through-perl-script