So I need an output of the remote process on my stdout, but I need also to be able to "listen" to it, and send the command after matching my keyword.
I need something like this (I know this code is not correct, it's only purpose is illustration of what I need)
#!/usr/bin/expect
log_user 0
spawn ssh -o PubkeyAuthentication=no [lindex $argv 0] -n [lindex $argv 1]
expect "Password:" {send "mypassword\r"}
interact
expect "mykeyword" {send "\003\177\015"}