英文:
expect if condition extra characters after close-quote while executing
问题
以下是您要翻译的部分:
我正在尝试执行此代码来处理自动化执行中可能发生的多个选择,但在此执行中有时会发生内部错误,并且发送“^”将使其继续到下一步,但我的代码失败。
这是代码:
expect {
"Enter RETURN to continue or '^' to exit:"
{send "^\n"; exp_continue }
"Select Systems Manager Menu Option:"
}
send "fm\n"
错误信息:
关闭引号后的额外字符
在执行时
{send "^\n"; exp_continue }
在其中调用
我尝试使用以下代码来解决此问题,但由于大括号内的双引号,我没有完全找到错误在哪里。
英文:
i am trying execute this code to handle multiple selections may occurs in the automation execution ,however in this execution sometimes an internal error occurs and sending "^" will make it continue to the next step but my code fails .
this is the code
expect {
"Enter RETURN to continue or '^' to exit:"
{send "^\n",exp_continue }
"Select Systems Manager Menu Option:"
}
send "fm\n"
the error
extra characters after close-quote
while executing
"send "^\n",exp_continue "
invoked from within
"expect {
-ex "Enter RETURN to continue or '^' to exit:"
{send "^\n",exp_continue }
-ex "Select Systems Manager Menu Option:"
}"
(file "./ClinicStop_extract.sh" line 29)
[root@localhost cron]#
i tried to handle this problem with this code but i didn't get exactly where is the mistake in it since the double quotes inside the {}
答案1
得分: 1
你需要在那一行上有两个语句,所以你需要使用分号来分隔它们,而不是逗号,即:
{send "^\n"; exp_continue }
英文:
You have two statements on that line, so you need a semicolon to separate them, not a comma, i.e.
{send "^\n"; exp_continue }
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论