ruby -n is the closest thing I found, but it repeats the whole script. Also it's not available for irb.
+1
A:
$ cat > hello.rb $hello = 'Hello, world!' puts $hello ^D $ irb irb(main):001:0> load 'hello.rb' Hello, world! => true irb(main):002:0> $hello => "Hello, world!"
A bit tedious, and local variables won't carry through. May be close enough for your usage? (This is basically like Python's execfile
.)
ephemient
2010-03-13 07:34:24