Linux standard input issue

Posted by George2 on Stack Overflow See other posts from Stack Overflow or by George2
Published on 2010-05-15T14:57:52Z Indexed on 2010/05/15 15:04 UTC
Read the original article Hit count: 290

Filed under:
|
|

Hello everyone,

I am new to Linux. And I am using Red Hat Enterprise Version 5. There is a ruby program which use standard input as its input (e.g. the Ruby program process input from standard input). I think standard input should be keyboard, correct?

So, I think other kinds of input (non-standard input) should not work (i.e. the ruby program should not be able to read input from such non-standard input), but actually I have tried using pipe works, I am so confused because I think pipe should be some other kinds of input -- other than standard input, why it could work? i.e. put text "123" in abc.txt with pipe, could achieve the same result as using keyboard as input to type "123" for the ruby program.

Here is the sample which works and makes me confused,

cat abc.txt | ~/test/rubysrc/foo.rb

thanks in advance, George

© Stack Overflow or respective owner

Related posts about linux

Related posts about ruby