【问题标题】:unable to send large commands to expect send无法发送大型命令以期望发送
【发布时间】:2014-03-15 02:03:36
【问题描述】:

无法发送大型命令以期望发送 coomand

awk -F\\\" '\"07/12/2013 01:12:49\" < \$2 && \$2 < \"07/12/2013 01:44:49\"' /home/user/code/testDir/Log/alarm.log

它给出输出

我正在尝试发送此命令以期望我收到语法错误,

有些地方我听说只接受 27 个字符长度的命令,对吗?

我尝试使用解决方法将命令拆分为多个发送它可以工作,但我需要在没有人工交互的情况下自动化所有事情。

expect "$prompt" {
    send "awk -F\\\" '\"07/12/2013 01:12:49\" < \$2 "
    send_user "...Press"
    expect_user -re ".*\[\r\n]+"
    send "  && \$2 < \"07/12/2013 01:50:39\"'"
    send_user "...Press"
    expect_user -re ".*\[\r\n]+"
    send " alarm.log\r\r"
}

【问题讨论】:

  • 我通过在 linux/unix 上运行这个脚本解决了这个问题。

标签: tcl expect


【解决方案1】:

Expect 没有这样的限制

set command {awk -F'"' '"07/12/2013 01:12:49" < $2 && $2 < "07/12/2013 01:44:49"' /home/user/code/testDir/Log/alarm.log}
send "$command\r"

【讨论】:

  • 是的,当我们使用 linux/unix 时没有限制,如果使用 windows 操作系统,我会收到此错误。
猜你喜欢
  • 1970-01-01
  • 2016-09-06
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-10-19
  • 1970-01-01
  • 2021-02-07
  • 1970-01-01
相关资源
最近更新 更多