#!/usr/bin/env ruby # coding: euc-jp lineno = 0 # 行番号をつける IO.popen("cal", "r") do |c| while line=c.gets printf("%d: %s", lineno+=1, line) end end