Memoize

BasicWerk   EC Support   Technique   Facebook  

20140910155530_ruby_STDERR

ruby_STDERR

 

 

STDERR への書き出し。2> でリダイレクト。

stderr.rb
 
#! /usr/bin/ruby
# coding: utf-8
 
puts "This is stdout."
STDERR.puts "This is stderr." 
 

 

 
% stderr.rb
This is stdout.
This is stderr.
 
% stderr.rb 2> err.txt
This is stdout.
 
% cat err.txt         
This is stderr.
 
% stderr.rb > out.txt 2> err.txt
 
% cat out.txt
This is stdout.
 
% cat err.txt                   
This is stderr.
 

 


© Shin Nakamura/BasicWerk 2014