I am pretty sure that all of you know the bash pipelines. What I am trying to do is to read the output from one ruby script and put it as input into other ruby script
here is what I successfully accomplished so far:
first file to generate the output
#one.rb
puts "hello"
and the second file to handle the input
#two.rb
msg = gets.chomp
IO.write(File.dirname(__FILE__)+'\out.txt',msg)
now, the cygwin command (or linux) (side question: can this be done as well in windows cmd or powershell?)
ruby one.rb | ruby two.rb
and voila, the out.txt file is created, filled with string hello.
However, when I try it to do it in the cycle or handling some stream of data, like 10.times puts 'hello' and the in cycle to read it, it did not work. Can somebody please help me to accomplish this or show me the way how can i do that? I have only find some python question but it was for something different and some bash-like-way.
Thank you!