title: How can I propagate an exit status from Expect to its parent Bash script?
body: <p>I have a bash script, exec.sh like</p>
  
  <pre><code>some command
  expect test.exp
  continue other command
  </code></pre>
  
  <p>in the test.exp file, I have a snippet like:</p>
  
  <pre><code>while {[gets $cmds command]&gt;=0} {
    send "$command\r"
    expect {
      "*OK*" {puts $vout $command}
      "*fail*" {puts $iout $command}
      "*blocked*" { what should I put here????}
      }  
    }
  </code></pre>
  
  <p>so I want to put something in the curly bracket so that the execution exit the test.exp and signal the bash script exec.sh, so exec.sh  also exit
  my idea is the set a outer variable and then in exec.sh use "if" judge statement</p>
  
  <p>are there any ideas? thanks!</p>