title: Expect - Interrupt program - Ctrl+C
body: <p>I am running the following script to start a capture on a remote server and download the file afterwards. Currently I have to pause it with <kbd>Ctrl</kbd>+<kbd>C</kbd> and manually exit.</p>
  
  <p>How can I replace the interact and define a trigger to kill the tcpdump or catch the <kbd>Ctrl</kbd>+<kbd>C</kbd> and pass it inside the remote server?</p>
  
  <pre class="lang-bash prettyprint-override"><code>spawn ssh "$user_ssh\@$ssh_server"
  
  expect {
          "*password"     { send "$pass\n";   exp_continue}
          "root\@*"       { }
          timeout  { puts "time out expecting password or bash"; exit 1 }
      }
  
  send "sudo tcpdump -i $intf -s0 -w $file -v\n";
  interact
  
  spawn scp "$user_ssh\@$ssh_server:$file" .
  
  expect "password:"
  send "$pass_ssh\n";
  expect "100\%"
  </code></pre>