title: expect output only stdout of the command and nothing else
body: <p>How to write expect script which executes command and prints just the command's output?</p>
  
  <p>I've tried various things but none works, e.g.</p>
  
  <pre><code>#!/usr/bin/expect
  log_user 0
  spawn bash
  send "echo 1\r"
  log_user 1
  expect "1"
  log_user 0
  send "exit\r"
  expect eof
  </code></pre>
  
  <p>Gives in output:</p>
  
  <blockquote>
    <p>echo 1</p>
  </blockquote>
  
  <p>While I need just "1" . I hope somebody knows simple solution how to fix my example</p>