#!/usr/bin/ruby inpipe = IO.popen( "ls", "r" ) while ( line = inpipe.gets ) print line.chomp + " " end print "\n" inpipe.close