title: Linux Expect expect_out(buffer) does contain nothing
body: <p>I've been trying to capture the result of grep, logging into a remote machine, using ssl in Expect command.
  I read "except_out(buffer)" variable to contain the output of the spawned process, but it seemed empty...
  A pointer'd be greatly appreciated!</p>
  
  <pre><code>#!/bin/bash
  
  username=hoge
  password=hoge
  hostname=machine20
  
  prompt="\[$username@$hostname ~\]$"
  
  expect -c "
  set timeout -1
  spawn ssh -l $username $hostname
  expect {
     \"$username@$hostname's password:\" {
    send \"$password\n\"
    } \"Are you sure you want to continue connecting (yes/no)?\" {
    send \"yes\n\"
    expect \"$username@$hostname's password:\"
    send \"$password\n\"
    }
  }
  
  expect \"$prompt\"
  sleep 2
  
  expect \"$prompt\"
  send \"ps axuw | grep java | grep -vc grep\n\"
  
  expect -re -indices \"(.*)\"
  send \"echo result : $expect_out(buffer)\"
  </code></pre>
  
  <p>expect version : 5.43.0</p>