Brian Candler wrote: > On Fri, Dec 13, 2002 at 10:22:33AM +0900, Michael C. Libby wrote: > >>Is there any way in irb to capture all of my input lines? I love to try >>stuff out in there, but it gets really annoying copying out my work from >>the sample output and all that. Anyway at the end of an irb session to >>type in some command and have it spit out a full history into a string or >>a file? > > > There's always the Unix 'script' utility: > > $ script foo > Script started, output file is foo > $ irb > irb(main):001:0> puts "hello, world!" > hello, world! > nil > irb(main):002:0> exit > $ exit > exit > > Script done, output file is foo > $ cat foo > Script started on Fri Dec 13 23:20:30 2002 > ... session transcript But that captures command-line editing control characters, output, ... If you just want input, put this in your .irbrc, assuming your irb is built with readline support: def dump_history(file=nil) if file File.open(file, "w") do |f| f.puts IRB::ReadlineInputMethod::HISTORY.to_a end else puts IRB::ReadlineInputMethod::HISTORY.to_a end end