% ./counter 0 % ./counter 1 % ./counter 2 % ./counter 3
#! /usr/bin/env ruby puts 0 source = open($0).read open($0, "w").write source.sub(/puts (\d+)/) { "puts #{$1.to_i+1}" }
https://gist.github.com/1527130#file_counter
% ./counter2 92 % ./counter2 93 % ./counter2 94 % ./counter2 95
#! /usr/bin/env ruby file = open($0, "r+") puts file.read.length file.write("1") 111111
https://gist.github.com/1527130#file_counter2
よろしくお願いします