Since an SSH package for Ruby doesn't exist right now, I have been
trying to implement an SSH client through Ruby by sending text
directly to the command line and retrieving the results. It's not
working, though.

I was originally trying to use code similar to this to run the SSH
program at the command line automatically and print the results:

cmd = open("|ssh www.myhost.com")
	cmd.each {|x| puts x}		
cmd.close

If I use open("|dir") or open("|date") or other similar programs that
are built-into MS-DOS, the program works as expected and outputs the
full text results. When I try to use open("|ssh www.myhost.com")
though, it returns nil.

Does anyone have any ideas about how to initiate an SSH session at the
command line through Ruby and be able to control it/send commands to
it? i.e. I need to be able to write something like this in Ruby

$stdin << "exit"

And the SSH program should then exit. I want to be able to send
commands to SSH (run at a command prompt) and receive commands from
SSH programmatically through Ruby.