in reply to Connecting to STDIN and STDOUT over SSH

I see three maybe four problems. The shell is needless invoked, ssh's arguments aren't properly converted into shell literals, $status contains junk, and you might want to intercept SIGPIPE.