# Starting another programs from inside

**URL:** <https://rubytalk.org/t/starting-another-programs-from-inside/40059>\
**Category:** ruby-talk\
**Created:** [20 August 2007 15:41 UTC](https://rubytalk.org/t/starting-another-programs-from-inside/40059 "2007-08-20T15:41:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jeff\_Bowen](https://avatars.discourse-cdn.com/v4/letter/j/439d5e/32.png) [@Jeff\_Bowen](https://rubytalk.org/u/Jeff_Bowen)\
**Post date:** [20 August 2007 15:41 UTC](https://rubytalk.org/t/starting-another-programs-from-inside/40059/1 "2007-08-20T15:41:47Z")

</div>

I searched ruby-talk but I could not find the answer.  
I want to start one program from inside another.

test.rb  
&nbsp;&nbsp;puts 'hi'

test1.rb  
&nbsp;&nbsp;`test.rb`

test1.rb results =\> Exec format error - test.rb  
(Errno::ENOEXEC)

Thanks  
Jeff

> **···**
>
> \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> Looking for a deal? Find great prices on flights and hotels with Yahoo! FareChase.  
> [http://farechase.yahoo.com/](http://farechase.yahoo.com/)

---

<div class="post-metadata">

**Author:** ![Michael\_Glaesemann](https://avatars.discourse-cdn.com/v4/letter/m/bc79bd/32.png) [@Michael\_Glaesemann](https://rubytalk.org/u/Michael_Glaesemann)\
**Post date:** [20 August 2007 15:50 UTC](https://rubytalk.org/t/starting-another-programs-from-inside/40059/2 "2007-08-20T15:50:50Z")

</div>

I think you need to make test.rb executable, which is what Errno::ENOEXEC is telling you.

Michael Glaesemann  
grzm seespotcode net

> **···**
>
> On Aug 20, 2007, at 10:41 , Jeffrey Bowen wrote:
> 
> > test1.rb  
> > &nbsp;&nbsp;`test.rb`
> > 
> > test1.rb results =\> Exec format error - test.rb  
> > (Errno::ENOEXEC)

---

<div class="post-metadata">

**Author:** ![Ari\_Brown](https://avatars.discourse-cdn.com/v4/letter/a/48db29/32.png) [@Ari\_Brown](https://rubytalk.org/u/Ari_Brown)\
**Post date:** [20 August 2007 17:49 UTC](https://rubytalk.org/t/starting-another-programs-from-inside/40059/3 "2007-08-20T17:49:54Z")

</div>

load "test.rb"  
or  
require "test.rb"  
-------------------------------------------------------|  
~ Ari  
crap my sig won't fit

> **···**
>
> On Aug 20, 2007, at 11:41 AM, Jeffrey Bowen wrote:
> 
> > I searched ruby-talk but I could not find the answer.  
> > I want to start one program from inside another.
> > 
> > test.rb  
> > &nbsp;&nbsp;puts 'hi'
> > 
> > test1.rb  
> > &nbsp;&nbsp;`test.rb`
> > 
> > test1.rb results =\> Exec format error - test.rb  
> > (Errno::ENOEXEC)

---

<div class="post-metadata">

**Author:** ![Stefano\_Crocco](https://avatars.discourse-cdn.com/v4/letter/s/5f9b8f/32.png) [@Stefano\_Crocco](https://rubytalk.org/u/Stefano_Crocco)\
**Post date:** [20 August 2007 15:56 UTC](https://rubytalk.org/t/starting-another-programs-from-inside/40059/4 "2007-08-20T15:56:44Z")

</div>

Alle lunedì 20 agosto 2007, Michael Glaesemann ha scritto:

> \> test1.rb  
> \> `test.rb`  
> \>  
> \> test1.rb results =\> Exec format error - test.rb  
> \> (Errno::ENOEXEC)
> 
> I think you need to make test.rb executable, which is what  
> Errno::ENOEXEC is telling you.
> 
> Michael Glaesemann  
> grzm seespotcode net

Or you can use

&nbsp;&nbsp;`ruby test.rb`

Of course, this assumes that the ruby executable is actually called ruby. By  
the way, using the backtick syntax, the output of the executed program is not  
displayed on the screen, but is returned as a result of the `` method call.  
If you the output from the executed program to be displayed, you can use the  
system method.

Stefano

> **···**
>
> > On Aug 20, 2007, at 10:41 , Jeffrey Bowen wrote:
