我正在使用简单的期望脚本,它等待“hi”并在缓冲区中显示内容。该脚本无法打印脚本的内容。我已经尝试了所有 4 种不同的方式(那些被注释的方式)来显示 expect_out(缓冲区)。建议以下脚本中的任何更改/修改
#!/bin/sh
#!/usr/bin/expect
expect "hi\r"
#puts "$expect_out(buffer)"
#send_user "$expect_out(buffer)\n"
#send "you typed <$expect_out(buffer)\r>"
#send "but I only expected <$expect_out(buffer)\r>"
提示如下错误“ can't read "expect_out(0,string)": no such variable while execution "puts "$expect_out(0,string)"" (file "./oreilly.exp" line 7)"