From: Rob Biedenharn Date: 2008-08-22T02:16:49+09:00 Subject: Re: Lower verbosity in IRB? On Aug 21, 2008, at 1:07 PM, James Coglan wrote: >> logfile=File.open("backup_08192008.log"){|f| f.read()} >> >> Normally, its fine that irb will barf out the contents of the file to >> screen. Normally it's even useful.... > > You need to get the statement to evaluate to something short, > preferably > nil. > > (log = File.read('backup_08192008.log')) && nil > > Then irb will print nil but log will still contain the data. > > James > http://blog.jcoglan.com > http://github.com/jcoglan I tend to just add ";nil" to the end as in: log = File.read('backup_08192008.log'); nil You could also add: ;log.size or: ;log.length or some such. The only downside is that _ won't be set to the thing you probably want, but since you're assigning to log anyway, that shouldn't matter. (I often follow a command with: x=_;nil when I forget to capture to a variable.) -Rob Rob Biedenharn http://agileconsultingllc.com Rob@AgileConsultingLLC.com