title: Can expect spawn a bash function?
body: <p>Here is a very simplified example:</p>
  
  <pre class="lang-none prettyprint-override"><code># expect -c "spawn socat -v -,raw,echo=0,nonblock /dev/ttyS0; interact"
  </code></pre>
  
  <p><code>expect</code> executes an in-line script, which spawns <code>socat</code> in order to connect to a <code>serial</code> device. But what if we have a <code>bash</code> function called serial (which is quite handy):</p>
  
  <pre class="lang-none prettyprint-override"><code># serial(){ socat -v -,raw,echo=0,nonblock /dev/ttyS0;}
  # expect -c "spawn serial; interact"
  spawn serial
  couldn't execute "serial": no such file or directory
      while executing
  "spawn serial"
  </code></pre>
  
  <p>Is it possible to force <code>expect</code> to execute a function, without a wrapper script or binary?</p>