From: Robert Klemme Date: 2003-07-30T11:21:48+09:00 Subject: Re: is it possible to pipe ruby to more / cat / arbitrary programs? "Tuan Bui" schrieb im Newsbeitrag news:bg366r$kcr$1@flapjack.cray.com... > Good morning, > > > I use Ruby as a scripting layer over another program, and I want to be > able to pipe the output of that program to unix programs. Is this > possible? I'm trying to do something like this: > > > #this will return output from the program in a string > programoutput = @program.send(input) > > #destprogram might be cat, grep, more, less, any such program > programoutput pipeoutput serr = Open3.popen3(destprogram) > > Does anyone know of a way to do this? > > Thanks, and have a grand old day. You can simply do system 'program | other' Or you can copy it yourself IO.popen( "ls", "r" ) do |ls| IO.popen( "cat", "w" ) do |cat| ls.each do |line| cat.puts line end end end Regards robert