通过perl脚本在linux中的密码提示符上登录

时间:2021-01-22 00:34:01

I want to pass a password through a Perl script. I am basically writing a script to execute commands on Linux terminal.

我想通过一个Perl脚本传递一个密码。我正在编写一个脚本,在Linux终端上执行命令。

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 .)

浏览后,我发现Expect但我得到一个错误的说法:无法找到Expect。@INC中的pm (@INC包含:C:/Perl/site/lib C:/Perl/lib)

I have not used Expect before so have no clue what do I need to install.

我以前没有使用过Expect,所以不知道我需要安装什么。

1 个解决方案

#1


3  

Expect.pm should work on Windows with latest Cygwin.

期望。pm应该使用最新的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/

如果我是正确的,您可以安装expect与PPM。然而,在我看来,它可能不工作:http://code.activestate.com/ppm/Expect/

It looks like IO-Tty fails to install on Windows. It should work on Cygwin.

看起来IO-Tty不能安装在Windows上。它应该对Cygwin有效。

#1


3  

Expect.pm should work on Windows with latest Cygwin.

期望。pm应该使用最新的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/

如果我是正确的,您可以安装expect与PPM。然而,在我看来,它可能不工作:http://code.activestate.com/ppm/Expect/

It looks like IO-Tty fails to install on Windows. It should work on Cygwin.

看起来IO-Tty不能安装在Windows上。它应该对Cygwin有效。