Login on password prompt in linux through perl script

萝らか妹 提交于 2021-02-10 05:49:09

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!