The SyncShell service allows you to execute commands on the shell and block until they finish. It is not fool-proof--it has to use some tricks to accomplish this task, and some commands may foul it up. But for most tasks, it works admirably. {{{lang=ruby,number=true,caption=Using the SyncShell service Net::SSH.start( 'localhost' ) do |session| shell = session.shell.sync out = shell.pwd p out.stdout out = shell.test "-e foo" p out.status out = shell.cd "/really/bogus/directory" p out.stderr p out.status out = shell.ruby "-v" p out.stdout out = shell.cd "/usr/lib" out = shell.ls "-l" p out.stdout out = shell.send_command( "bc", <