通过 perl 脚本在 linux 中的密码提示下登录 [英] Login on password prompt in linux through perl script

查看:35
本文介绍了通过 perl 脚本在 linux 中的密码提示下登录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过 Perl 脚本传递密码.我基本上是在写一个脚本来在 Linux 终端上执行命令.

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.

浏览后,我找到了 Expect 但我收到一条错误消息:Can't locate Expect.pm in @INC (@INC contains: C:/Perl/site/lib C:/Perl/lib .)

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 所以不知道我需要安装什么.

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

推荐答案

Expect.pm 应该可以在带有最新 Cygwin 的 Windows 上运行.

Expect.pm should work on Windows with latest Cygwin.

如果我是对的,您可以使用 PPM 安装 expect.但是,在我看来它可能不起作用:http://code.activestate.com/ppm/期待/

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/

IO-Tty 似乎无法在 Windows 上安装.它应该适用于 Cygwin.

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

这篇关于通过 perl 脚本在 linux 中的密码提示下登录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆