Re: Calling Shell Scripts from Ruby?

1)Is it possible to call “Shell Scripts” from ruby? Say if i
have a shell sciprt named “”, how can i call this from
ruby? Also if i can call like that,is it possible to get the
output of that script passed back to ruby?

Shell scripts fall into “any Unix command” category, so keep on reading.

2)How can i call any “Unix command” residing from a ruby program??

  1. Backquotes

result =

  1. exec(), fork/exec

exec ‘’

Process.wait fork {
exec ‘’

  1. popen(), popen3(), etc.

IO.popen(‘’) { |_io|

  1. Good old system()


Read about all those facilities in the documentation to get the most out
of it.


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs