From: "Jesús Gabriel y Galán" Date: 2010-08-20T06:29:01+09:00 Subject: Re: (How) Can you run another ruby script, from a ruby script? On Thu, Aug 19, 2010 at 5:32 PM, 3lionz Wexler <3lionzw@gmail.com> wrote: > Sorry for the newbie question, but Can you run another ruby script, from > a ruby script? > > For example: > #makes new .rb script > f = File.open('test.rb', 'w+') > f.write("puts 'Hello world' > sleep 5 # seconds") > f.close It's better to use the block form of File.open, it ensures that the file is closed: File.open('test.rb', 'w+') do |f| f.write("puts 'Hello world'") sleep 5 # seconds end > #run test.rb load './test.rb' > sleep 5 # seconds > #wait 5 seconds > end Jesus.