title: Return exit status code from inline Expect command
body: <p>How do you make Expect to return the exit status codes rather than a 0 or 1 when executing expect -c.</p>
  
  <p>For example, after executing the following line I expect to have "17" returned, but instead I get "0" signalling that the command successfully ran.</p>
  
  <pre><code>expect -c "spawn echo \"foo\"; expect { -re \"foo\" { exit 17 } }"; echo $?
  </code></pre>