I want to know if there’s a more ‘portable’ way to do this in ruby:
I hope my programe will accept data from redirected stdin or pipe, like
cat bar | foo.rb
foo.rb < bar
And after read the data I want to interact with the foo.rb in console.
The problem is stdin has been redirected so I have to:
Hardcoding a string in the script seems not good. Any suggestions?