I'd like to write a ruby script that then calls another ruby script. Example, I'd like to run the "test1.rb" from my script. The test1.rb has been simplified to just do this:
print "1"
Then get the result (-> 1).
I tried to complete this problem with backticks or another executing command (%x[#{"test1.rb"}], system("test1.rb") etc.), but it didn't work.
So any idea how I call one script that then calls another script (either relinquishing total control or forking), and get the results?
Thanks
system("test1.rb")do? Did you try this with full (absolute) path totest.rb?test1.rbon the command line won't work:test1.rbisn't an executable file. You either need to execute the script with Ruby (e.g.system("ruby", "test1.rb")) or make the file executable withchmodand adding a shebang line.