Tag: file

如果没有arg,则运行stdin的脚本; 否则输入文件= ARGV

这很好用 – 只是想知道是否有任何改进来缩短它? if (ARGV[0].nil?) then input=$< else input=File.new(ARGV[0],"r"); end … # Do something with the input here, for example: input.each_line do |line| puts line end