Search code examples
linuxautomationtclexpect

expect if condition extra characters after close-quote while executing


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 {}


Solution

  • You have two statements on that line, so you need a semicolon to separate them, not a comma, i.e.

    {send "^\n"; exp_continue }