ruby的相关文件操作。
filename = ARGV.first txt = open(filename) puts txt.readline puts "-----------" puts txt.readline
filename = "test.txt" txt = open(filename, 'w') line = "line in test.txt" txt.write(line) txt.write("\n") txt.close