title: In expect script, output of grep is not saved in expect_out(buffer)
body: <p>I have a script that greps a file for a certain value but the response of the grep is not saved in expect_out(buffer).  Below is my code:</p>
  
  <pre><code>#!/usr/bin/expect 
  
  set prompt "(%|&gt;|#|\\$)"
  #set prompt "(%|&gt;|\\$)"
  
  set pidBash [ spawn bash ]
  puts "\nStarting script....."
  
  send -- "\n"
  expect -re $prompt {}
  set output $expect_out(buffer)
  send -- "grep '^option' /home/pb791b/udhcpd.conf | grep lease\n"
  sleep 4
  expect -re $prompt {}
  
  set output $expect_out(buffer)
  set outputLines [split $output "\n"]
  set len [llength $outputLines]
  puts "\nlen: $len\n"
  for {set i 0} {$i&lt;[expr $len]} {incr i} {
      set line [lindex $outputLines $i]
      puts "line $i: $line"
  }
  
  exec kill $pidBash
  puts "\nprocess Bash terminated"
  
  puts "End script."
  </code></pre>
  
  <p>Below is my output:</p>
  
  <pre><code>pb791b@pb791b-VirtualBox:~/devtest/ngs/base/Tests/shellScripts$ ./temp2.sh 
  spawn bash
  
  Starting script.....
  
  pb791b@pb791b-VirtualBox:~/devtest/ngs/base/Tests/shellScripts$ 
  grep '^option' /home/pb791b/udhcpd.conf | grep lease
  pb791b@pb791b-VirtualBox:~/devtest/ngs/base/Tests/shellScripts$ grep '^option' /home/pb791b/udhcpd.conf | grep lease
  option  lease   864000      # 10 days of seconds
  pb791b@pb791b-VirtualBox:~/devtest/ngs/base/Tests/shellScripts$ 
  len: 3
  
  line 0:  
  line 1: grep '^option' /home/pb791b/udhcpd.conf | grep lease
  line 2: pb791b@pb791b-VirtualBox:~/devtest/ngs/base/Tests/shellScripts$
  
  process Bash terminated
  End temp.sh script.
  pb791b@pb791b-VirtualBox:~/devtest/ngs/base/Tests/shellScripts$ 
  </code></pre>
  
  <p>When I print expect_out(buffer), it prints the grep command and then the prompt but is missing the output of grep  "option  lease   864000      # 10 days of seconds"</p>