转换linux .exp文件以在Windows上运行 [英] converting a linux .exp file to run on windows

查看:85
本文介绍了转换linux .exp文件以在Windows上运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在转换一部分Linux代码以在Windows上运行.我找到了一个电话:

Hi,
I''m in the process of converting a load of linux code to run on windows. I have found a call to:

system(".\sr_halt2.exp");


文件sr_halt2.exp包含:


The file sr_halt2.exp contains:

#! /usr/bin/expect -f
# This example expect script will run halt on an SR
# that is ready for a new command to be issued.
#
# Edit this script, changing the shelf address and
# ethernet interface appropriately.
#

set send_slow {1 .1}
proc send {ignore arg} {
    sleep .3
    exp_send -s -- $arg
}
set timeout -1
spawn ./cec -s 1 eth2
match_max 100000
expect -exact "Probing for shelves ... shelf 1 found.\r
connecting ... done.\r
Escape is Ctrl-\\\r
"
send -- "\r"
expect -exact "\r\r
SR shelf 1> "
send -- "halt\r"
expect -exact "halt\r\r
halted: hit return to reboot: "
send -- ""
expect -exact ">>> "
send -- "q\r"
expect eof



现在,似乎似乎我做了一个非常可悲的尝试,但是我实际上已经徘徊了很长时间,试图将其工作以及如何编写它在Windows机器上做到这一点拼凑起来.但是,我实际上什么都没有取得.



Now, it probably seems like I have made a really pathetic attempt, but i have actually hunted around for quite a while trying to piece together what this does and how to write it to do the same on a windows machine. But I have achieved virtually nothing. Is there anyone who can tell me something or point me in the right direction please?

推荐答案

arg } 设置超时-1 生成./cec -s 1 eth2 match_max 100000 期望-精确正在探测货架...找到了货架1.\ r 正在连接...完成.\ r 转义是Ctrl-\\\ r " 发送-"\ r" 期望-exact"\ r \ r SR架1> " 发送-停止\ r" 期望-精确停止\ r \ r 暂停:按回车键重启: 发送 - "?" 期望-精确的>>>" 发送-"q \ r" 期待eof
arg } set timeout -1 spawn ./cec -s 1 eth2 match_max 100000 expect -exact "Probing for shelves ... shelf 1 found.\r connecting ... done.\r Escape is Ctrl-\\\r " send -- "\r" expect -exact "\r\r SR shelf 1> " send -- "halt\r" expect -exact "halt\r\r halted: hit return to reboot: " send -- "" expect -exact ">>> " send -- "q\r" expect eof



现在,似乎似乎我做了一个非常可悲的尝试,但是我实际上已经徘徊了很长时间,试图将其工作以及如何编写它在Windows机器上做到这一点拼凑起来.但是,我实际上什么都没有取得.有没有人可以告诉我一些事情或为我指明正确的方向?



Now, it probably seems like I have made a really pathetic attempt, but i have actually hunted around for quite a while trying to piece together what this does and how to write it to do the same on a windows machine. But I have achieved virtually nothing. Is there anyone who can tell me something or point me in the right direction please?


请参阅期待Windows" [
See "Expect for Windows" [^] or search for the same term.

However, the script calls the cec (Coraid Ethernet Console) command which may be not usable by Windows in this way (using Expect).


您知道期望"自动化/测试工具是否也可用于Windows?请参阅:
http://en.wikipedia.org/wiki/Expect [ http://www.nist.gov/el/msid/expect.cfm [ ^ ].

您可以获取Windows二进制文件或从源代码下载并构建它:
http://sourceforge.net/projects/expect/ [
Do you know that "expect" automation/testing tool is also available for Windows? Please see:
http://en.wikipedia.org/wiki/Expect[^],
http://www.nist.gov/el/msid/expect.cfm[^].

You can get Windows binaries or download and build it from source:
http://sourceforge.net/projects/expect/[^].

Having that, you can hope to run your scripts with little or no modifications.

—SA


这篇关于转换linux .exp文件以在Windows上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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