views:

69

answers:

2

Hi guys,

The following command which you can use in the cygwin console to output text in this console.

ruby -e 'STDOUT << "ABC" << " DEF"'

My question is: the STDOUT part is a ruby keyword or a cygwin keyword? How can I use it? Great thanks.

+1  A: 

STDOUT is a pre-defined global constant in Ruby. You can also use $stdout or $>.

Jonas Elfström
Thanks for your answer!
Yousui
+1  A: 

STDOUT is a Ruby global constant. It is an instance of the IO class that outputs to standard output stream. $> and $stdout are references to the same IO instance.

In your example, you are calling the << method of IO, which writes out the argument and then returns itself.

Phil Ross
Thanks for your answer!
Yousui