Richard Ryan <ryanr / 12-253-103-174.client.attbi.com> writes:

> Thank you for the suggestion, but perhaps I should have been more
> specific about what I really want to do.  The following is closer to
> what I'm interested in.  It's a very common lick to play in Korn,
> perl and C and if I have to go through a symphony to do the same
> thing in ruby then, to paraphrase the great American poet Chuck
> Berry, I'll lose the beauty of the melody.

Is this along the right lines?

     old_stdout = $stdout.clone
     old_stderr = $stderr.clone
     $stdout.reopen("stdout", "w")
     $stderr = $stdout
     puts "Hello world"
     system "ls -l a*"
     system "ls non_existent_file"
     $stdout = old_stdout
     $stderr = old_stderr
     puts "done"


Cheers


Dave