Is the keyword "STDOUT" ruby- or cygwin-specific in this command?
The fol开发者_如何学JAVAlowing 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.
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.
STDOUT
is a pre-defined global constant in Ruby. You can also use $stdout
or $>
.
精彩评论