# Executing Files (without shell)

**URL:** <https://www.ruby-forum.com/t/executing-files-without-shell/123103>\
**Category:** Ruby\
**Created:** [December 14, 2007, 12:27am UTC](https://www.ruby-forum.com/t/executing-files-without-shell/123103 "2007-12-14T00:27:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![thefed](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e47c2d/32.png) [@thefed](https://www.ruby-forum.com/u/thefed)\
**Post date:** [December 14, 2007, 12:27am UTC](https://www.ruby-forum.com/t/executing-files-without-shell/123103/1 "2007-12-14T00:27:43Z")

</div>

Once again, a similarly themed question from me:

Is it possible (without syscall ) to execute a file without using a  
shell?

Thanks  
\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_|

- Ari  
I just bought another case of RockStar. Expect architectural changes.

---

<div class="post-metadata">

**Author:** ![thefed](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e47c2d/32.png) [@thefed](https://www.ruby-forum.com/u/thefed)\
**Post date:** [December 14, 2007, 1:42am UTC](https://www.ruby-forum.com/t/executing-files-without-shell/123103/2 "2007-12-14T01:42:07Z")

</div>

On Thu, 13 Dec 2007 18:27:10 -0500, thefed wrote:

> Once again, a similarly themed question from me:
> 
> Is it possible (without syscall ) to execute a file without using a  
> shell?

Calling Kernel#system will sometimes fork a shell if you pass it  
something complicated like pipelines, but you can be guaranteed that it  
won’t spawn a shell (it will execve the binary directly) if you pass the  
binary name and the command line arguments as separate parameters. (E.g.  
system(“echo”,“hello”,“world”) Likewise if you’re running a binary that  
takes no parameters so there’s only one string being passed as a  
parameter.

–Ken

---

<div class="post-metadata">

**Author:** ![thefed](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e47c2d/32.png) [@thefed](https://www.ruby-forum.com/u/thefed)\
**Post date:** [December 14, 2007, 3:19am UTC](https://www.ruby-forum.com/t/executing-files-without-shell/123103/3 "2007-12-14T03:19:50Z")

</div>

On Dec 13, 2007, at 7:40 PM, Ken B. wrote:

> won’t spawn a shell  
> Guarenteed? Are you certain? I just want to be sure…

-------------------------------------------------------|  
~ Ari  
crap my sig won’t fit
